chore(llc): add index check in unreadCount setter.

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2021-12-01 01:10:18 +05:30
committed by xsahil03x
parent 9315b13a04
commit e5a1a74f07
@@ -1860,6 +1860,9 @@ class ChannelClientState {
set unreadCount(int count) {
final reads = [..._channelState.read];
final currentUserReadIndex = reads.indexWhere(_isCurrentUserRead);
if (currentUserReadIndex < 0) return;
reads[currentUserReadIndex] =
reads[currentUserReadIndex].copyWith(unreadMessages: count);
_channelState = _channelState.copyWith(read: reads);