didUpdate method
Updates the computed value by re-running the getter.
Clears old dependencies, runs the getter with dependency tracking enabled, and returns whether the value changed.
Returns true if the computed value changed, false otherwise.
Implementation
bool didUpdate() {
if ((flags & hasChildEffect) != ReactiveFlags.none) {
disposeChildDepsInReverse(this);
}
depsTail = null;
flags = ReactiveFlags.mutable | ReactiveFlags.recursedCheck;
final prevSub = setActiveSub(this);
try {
++cycle;
final previousValue = currentValue;
final previousFailure = _failure;
final nextValue = getter(previousValue);
currentValue = nextValue;
if (previousFailure != null) _failure = null;
return previousFailure != null || !identical(previousValue, nextValue);
} on Object catch (error, stackTrace) {
_failure = (error: error, stackTrace: stackTrace);
return true;
} finally {
activeSub = prevSub;
flags &= -5 /*~ReactiveFlags.recursedCheck*/;
purgeDeps(this);
}
}