chore(llc): add index check in unreadCount setter.
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -1860,6 +1860,9 @@ class ChannelClientState {
|
|||||||
set unreadCount(int count) {
|
set unreadCount(int count) {
|
||||||
final reads = [..._channelState.read];
|
final reads = [..._channelState.read];
|
||||||
final currentUserReadIndex = reads.indexWhere(_isCurrentUserRead);
|
final currentUserReadIndex = reads.indexWhere(_isCurrentUserRead);
|
||||||
|
|
||||||
|
if (currentUserReadIndex < 0) return;
|
||||||
|
|
||||||
reads[currentUserReadIndex] =
|
reads[currentUserReadIndex] =
|
||||||
reads[currentUserReadIndex].copyWith(unreadMessages: count);
|
reads[currentUserReadIndex].copyWith(unreadMessages: count);
|
||||||
_channelState = _channelState.copyWith(read: reads);
|
_channelState = _channelState.copyWith(read: reads);
|
||||||
|
|||||||
Reference in New Issue
Block a user