resolveAllWith<R> method

FutureOr<R> resolveAllWith<R>(
  1. FutureOr<R> resolver()
)

Resolves all elements then resolves with resolver result.

Implementation

FutureOr<R> resolveAllWith<R>(FutureOr<R> Function() resolver) {
  var self = this;

  if (_isNotFuture(T) && (self is List<T> || self is Set<T>)) {
    return resolver();
  }

  var all = allAsList;

  if (all.isAllResolved) {
    return resolver();
  } else {
    return Future.wait(all.asFutures).then((r) => resolver());
  }
}