SideEffects<T>.onAll constructor
SideEffects<T>.onAll ({
- required void onWaiting()?,
- required void onError(
- dynamic err,
- VoidCallback refresh
- required void onData(
- T data
- void initState()?,
- void dispose()?,
Handle all possible for state status. Null argument will be ignored.
Implementation
factory SideEffects.onAll({
required void Function()? onWaiting,
required void Function(dynamic err, VoidCallback refresh)? onError,
required void Function(T data)? onData,
void Function()? initState,
void Function()? dispose,
}) {
return SideEffects(
initState: initState,
dispose: dispose,
onSetState: (snap) {
if (snap.isWaiting) {
onWaiting?.call();
return;
}
if (snap.hasError) {
onError?.call(snap.snapError!.error, snap.snapError!.refresher);
return;
}
onData?.call(snap.data as T);
},
);
}