stateOrNull property

  1. @protected
  2. @visibleForTesting
State? get stateOrNull
inherited

The value currently exposed by this Notifier.

If used inside Notifier.build, may return null if the notifier is not yet initialized. It will also return null if Notifier.build threw.

Invoking the setter will notify listeners if updateShouldNotify returns true. By default, this will compare the previous and new value using identical.

Reading stateOrNull if the provider is out of date (such as if one of its dependency has changed) will trigger Notifier.build to be re-executed.

Implementation

@protected
@visibleForTesting
State? get stateOrNull {
  _element.flush();
  return _element.getState()?.stateOrNull;
}