OnCombined<T, R>.or constructor Null safety

OnCombined<T, R>.or(
  1. {R onIdle(
      )?,
    1. R onWaiting(
        )?,
      1. R onError(
        1. dynamic error,
        2. void refresh(
            )
          )?,
        3. R onData(
          1. T state
          )?,
        4. required R or(
          1. T state
          )}
        )

        Set of callbacks to be invoked when the Injected models emit notifications 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 OnCombined.all.

        Implementation

        factory OnCombined.or({
          R Function()? onIdle,
          R Function()? onWaiting,
          R Function(dynamic error, void Function() refresh)? onError,
          R Function(T state)? onData,
          required R Function(T state) or,
        }) {
          return OnCombined._(
            onIdle: onIdle != null ? (_) => onIdle() : or,
            onWaiting: onWaiting != null ? (_) => onWaiting() : or,
            onError: onError != null
                ? (_, dynamic err, void Function() refresh) => onError(err, refresh)
                : (s, dynamic err, __) => or(s),
            onData: onData ?? or,
          );
        }