resolveAllReduced<R> method

Future<T> resolveAllReduced<R>(
  1. T reducer(
    1. T value,
    2. T element
    )
)

Resolves this Futures and reduces values with reducer.

Implementation

Future<T> resolveAllReduced<R>(T Function(T value, T element) reducer) {
  if (isEmpty) {
    return Future.value(<T>[].reduce(reducer));
  }

  return Future.wait(this).then((l) {
    return l.reduce(reducer);
  });
}