onAll<R> method
R
onAll<R>({
- R onIdle()?,
- required R onWaiting()?,
- required R onError(
- dynamic error,
- VoidCallback refreshError
- required R onData(
- T data
Listen to the injected Model and rebuild when it emits a notification.
- Required parameters:
onIdle
: callback to be executed when injected model is in its initial state.onWaiting
: callback to be executed when injected model is in waiting state.onError
: callback to be executed when injected model has error.onData
: callback to be executed when injected model has data.
- Optional parameters:
initState
: callback to be executed when the widget is first inserted into the widget tree.dispose
: callback to be executed when the widget is removed from the widget tree.shouldRebuild
: Callback to determine whether this StateBuilder will rebuild or not.onSetState
:For side effects before rebuilding the widget tree.onAfterBuild
:For side effects after rebuilding the widget tree.debugPrintWhenRebuild
: Print state transition log.
Implementation
R onAll<R>({
R Function()? onIdle,
required R Function()? onWaiting,
required R Function(dynamic error, VoidCallback refreshError)? onError,
required R Function(T data) onData,
}) {
return onOrElse<R>(
onIdle: onIdle,
onWaiting: onWaiting,
onError: onError,
orElse: onData,
);
}