refresh method

  1. @override
  2. @mustCallSuper
void refresh()
inherited

It's used to notify listeners that the state has been updated. It is typically called after making changes to the state object.

This method triggers the Lifecycle.didUpdate event, which allows listeners to react to the updated state.

Implementation

@override
@mustCallSuper
void refresh() {
  assert(!_isDisposed, "Can't refresh when it's been disposed");

  if (!_hasListeners || _isUpdating) {
    return _notify(Lifecycle.didUpdate);
  }

  _isUpdating = true;
  _notify(Lifecycle.didUpdate);
  _isUpdating = false;
}