notify method
bool
notify({
- SnapState<
T> ? nextSnap, - SideEffects<
T> ? sideEffects, - bool shouldOverrideDefaultSideEffects(
- SnapState<
T>
- SnapState<
- StateInterceptor<
T> ? stateInterceptor,
override
Notify observers
Implementation
@override
bool notify({
SnapState<T>? nextSnap,
SideEffects<T>? sideEffects,
bool Function(SnapState<T>)? shouldOverrideDefaultSideEffects,
StateInterceptor<T>? stateInterceptor,
}) {
if (nextSnap != null) {
final interceptedSnap = interceptState(nextSnap, stateInterceptor);
if (interceptedSnap?.isWaiting == true || nextSnap.isWaiting) {
if (!_snapState.isWaiting) {
completer ??= Completer();
}
} else {
if (_snapState.isWaiting) {
if (completer?.isCompleted == false) {
completer!.complete(interceptedSnap?.data ?? nextSnap.data);
completer = null;
}
}
}
if (interceptedSnap == null) {
return false;
}
_snapState = interceptedSnap;
}
sideEffects
?..onSetState?.call(_snapState)
.._onAfterBuild?.call();
rebuildState();
return true;
}