resolveAllThen<R> method

FutureOr<R> resolveAllThen<R>(
  1. FutureOr<R> onValues(
    1. List<T> values
    )
)

Same as Future.wait(this).then.

  • Note: it's not possible to implement onError and have the same behavior at Future.then, since onError will be called only if this is a Future, and not when it's a T.

Implementation

FutureOr<R> resolveAllThen<R>(FutureOr<R> Function(List<T> values) onValues) {
  var all = resolveAll();

  if (all is List<T>) {
    return onValues(all);
  } else {
    return all.then(onValues);
  }
}