File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -488,20 +488,28 @@ class Unreads extends ChangeNotifier {
488
488
}
489
489
}
490
490
491
- void _removeAllInStreamTopic (Set <int > incomingMessageIds, int streamId, TopicName topic) {
491
+ QueueList < int > ? _removeAllInStreamTopic (Set <int > incomingMessageIds, int streamId, TopicName topic) {
492
492
final topics = streams[streamId];
493
- if (topics == null ) return ;
493
+ if (topics == null ) return null ;
494
494
final messageIds = topics[topic];
495
- if (messageIds == null ) return ;
495
+ if (messageIds == null ) return null ;
496
496
497
497
// ([QueueList] doesn't have a `removeAll`)
498
- messageIds.removeWhere ((id) => incomingMessageIds.contains (id));
498
+ final removedMessageIds = QueueList <int >();
499
+ messageIds.removeWhere ((id) {
500
+ if (incomingMessageIds.contains (id)) {
501
+ removedMessageIds.add (id);
502
+ return true ;
503
+ }
504
+ return false ;
505
+ });
499
506
if (messageIds.isEmpty) {
500
507
topics.remove (topic);
501
508
if (topics.isEmpty) {
502
509
streams.remove (streamId);
503
510
}
504
511
}
512
+ return removedMessageIds;
505
513
}
506
514
507
515
// TODO use efficient model lookups
You can’t perform that action at this time.
0 commit comments