mergeAsyncValues3<R, A, B, C> function

AsyncValue<R> mergeAsyncValues3<R, A, B, C>(
  1. AsyncValue<A> a,
  2. AsyncValue<B> b,
  3. AsyncValue<C> c,
  4. R callback(
    1. A,
    2. B,
    3. C
    ),
)

Merges three async values into one async value using the provided callback function.

Implementation

AsyncValue<R> mergeAsyncValues3<R, A, B, C>(
  AsyncValue<A> a,
  AsyncValue<B> b,
  AsyncValue<C> c,
  R Function(A, B, C) callback,
) {
  final merged = a.mergeWith<B, List>(b, (a, b) => [a, b]);
  return merged.mergeWith<C, R>(
    c,
    (list, c) => callback(list[0], list[1], c),
  );
}