updateComputed method
Updates the computed subscriber's value and returns whether it changed.
This function should be called when a computed subscriber is marked as Dirty.
The computed subscriber's getter function is invoked, and its value is updated.
If the value changes, the new value is stored, and the function returns true
.
computed
- The computed subscriber to update.
Returns true
if the computed subscriber's value changed; otherwise false
.
Implementation
@override
bool updateComputed(Computed computed) {
final prevSub = activeSub;
activeSub = computed;
startTracking(computed);
try {
return computed.notify();
} finally {
activeSub = prevSub;
endTracking(computed);
}
}