state property
The current "state" of this StateNotifier.
Updating this variable will synchronously call all the listeners. Notifying the listeners is O(N) with N the number of listeners.
Updating the state will throw if at least one listener throws.
Implementation
@protected
T get state {
assert(_debugIsMounted());
return _state;
}
Implementation
@protected
set state(T value) {
assert(_debugIsMounted());
_state = value;
_controller?.add(value);
var didThrow = false;
for (final listenerEntry in _listeners) {
try {
listenerEntry.listener(value);
} catch (error, stackTrace) {
didThrow = true;
if (onError != null) {
onError(error, stackTrace);
} else {
Zone.current.handleUncaughtError(error, stackTrace);
}
}
}
if (didThrow) {
throw Error();
}
}