update method

  1. @mustCallSuper
void update(
  1. covariant Function fnUpdate
)

Executes fnUpdate, and notify the listeners about to update.

Implementation

@mustCallSuper
void update(covariant Function fnUpdate) {
  assert(!_isDisposed, "You can update when it's been disposed");

  if (!_hasListeners || _isUpdating) {
    fnUpdate();
    return;
  }

  _isUpdating = true;

  _notify(Lifecycle.willUpdate);
  fnUpdate();
  _notify(Lifecycle.didUpdate);

  _isUpdating = false;
}