On<T>.or constructor
On<T>.or ({
- T onIdle()?,
- T onWaiting()?,
- T onError(
- dynamic err,
- void refresh()
- T onData()?,
- required T or(),
Set of callbacks to be invoked when the Injected model emits a notification with the corresponding state status.
onIdle
, onWaiting
, onError
and onData
are optional. Non defined ones
default to the or
callback.
To be forced to define all state status use On.all.
Implementation
factory On.or({
T Function()? onIdle,
T Function()? onWaiting,
T Function(dynamic err, void Function() refresh)? onError,
T Function()? onData,
required T Function() or,
}) {
return On._(
onIdle: onIdle ?? or,
onWaiting: onWaiting ?? or,
onError: onError ?? (dynamic _, void Function() __) => or(),
onData: onData ?? or,
// onType: _OnType.when,
);
}