OnCombined<T, R> constructor Null safety

OnCombined<T, R>(
  1. R builder(
    1. T state
    )
)

The callback is always invoked when any of the Injected models emits a notification. Callbacks to be invoked depending on the combined state status of a list of Injected models

For more control on when to invoke the callbacks use:

  • OnCombined.data: The callback is invoked only if all the Injected models have data.
  • OnCombined.waiting: The callback is invoked if any of the injected models is waiting.
  • OnCombined.error: The callback is invoked if all the injected models are not waiting and at least one of them has error.

See also: OnCombined.all, OnCombined.or.

Implementation

// factory OnCombined.any(
//   R Function(T state) builder,
// ) {
//   return OnCombined._(
//     onIdle: null,
//     onWaiting: null,
//     onError: null,
//     onData: builder,
//     // onType: _OnType.when,
//   );
// }

///{@macro OnCombined}
factory OnCombined(
  R Function(T state) builder,
) {
  return OnCombined._(
    onIdle: builder,
    onWaiting: builder,
    onError: (T state, dynamic _, void Function() __) => builder(state),
    onData: builder,
    // onType: _OnType.when,
  );
}