update method
Executes fnUpdate
, and notify the listeners about to update.
This method triggers the Lifecycle.didUpdate
event,
which allows listeners to react to the updated state.
Implementation
@override
@mustCallSuper
void update(covariant Function fnUpdate) {
assert(!_isDisposed, "Can't update when it's been disposed");
if (!_hasListeners || _isUpdating) {
fnUpdate();
return;
}
_isUpdating = true;
_notify(Lifecycle.willUpdate);
fnUpdate();
_notify(Lifecycle.didUpdate);
_isUpdating = false;
}