This repository was archived by the owner on Feb 22, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -429,6 +429,7 @@ class Watch extends ChangeListener {
429
429
430
430
/// Calls the [_reactionFn] when the observed [Record] value changes
431
431
void _onChange (value, previous) {
432
+ assert (_triggerRecord._watchGroup.isAttached);
432
433
super ._onChange (value, previous);
433
434
_reactionFn (value, previous);
434
435
}
@@ -453,6 +454,8 @@ abstract class ChangeListener {
453
454
/// current listener.
454
455
void remove () {
455
456
if (_triggerRecord != null ) {
457
+ // The [WatchGroup] has been detached, no need to remove individual [Record] / [Watch]
458
+ if (! _triggerRecord._watchGroup.isAttached) return ;
456
459
if (identical (_triggerRecord._listenerHead, this )) {
457
460
_triggerRecord._listenerHead = _listenerNext;
458
461
if (_triggerRecord._listenerHead == null ) {
@@ -714,8 +717,7 @@ class Record extends ChangeListener {
714
717
}
715
718
716
719
void remove () {
717
- // Nothing to do as the [WatchGroup] has already been detached
718
- if (! _watchGroup.isAttached) return ;
720
+ assert (_watchGroup.isAttached);
719
721
720
722
// Update watch counters
721
723
if (isCollectionMode) {
You can’t perform that action at this time.
0 commit comments