combine2<A, B, R> static method

CombineLatestNotifier<dynamic, R> combine2<A, B, R>(
  1. ResultListenable<A> notifierA,
  2. ResultListenable<B> notifierB, {
  3. required R combineData(
    1. A a,
    2. B b
    ),
  4. R? data,
  5. Result<R>? result,
  6. Duration? expiration,
  7. ResultNotifierCallback<R>? onReset,
  8. R onErrorReturn(
    1. Object? error
    )?,
  9. bool autoReset = false,
  10. bool refreshOnError = false,
  11. bool ignoreLoading = false,
})

Constructs a CombineLatestNotifier that combines the data from the provided notifiers using the specified combineData function.

See CombineLatestNotifier.new.

Implementation

static CombineLatestNotifier<dynamic, R> combine2<A, B, R>(
  ResultListenable<A> notifierA,
  ResultListenable<B> notifierB, {
  required R Function(A a, B b) combineData,
  R? data,
  Result<R>? result,
  Duration? expiration,
  ResultNotifierCallback<R>? onReset,
  R Function(Object? error)? onErrorReturn,
  bool autoReset = false,
  bool refreshOnError = false,
  bool ignoreLoading = false,
}) {
  return CombineLatestNotifier<dynamic, R>(
    [notifierA, notifierB],
    combineData: (data) => combineData(data[0] as A, data[1] as B),
    data: data,
    result: result,
    expiration: expiration,
    onReset: onReset,
    onErrorReturn: onErrorReturn,
    autoReset: autoReset,
    refreshOnError: refreshOnError,
    ignoreLoading: ignoreLoading,
  );
}