onAll<R> method

R onAll<R>({
  1. R onIdle()?,
  2. required R onWaiting()?,
  3. required R onError(
    1. dynamic error,
    2. VoidCallback refreshError
    )?,
  4. required R onData(
    1. 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,
}) {
  ReactiveStatelessWidget.addToObs?.call(this as ReactiveModelImp);
  return snapState.onAll<R>(
    onIdle: onIdle,
    onWaiting: onWaiting,
    onError: onError,
    onData: onData,
  );
}