resolveBoth<R> method

Future<R> resolveBoth<R>(
  1. FutureOr<T> other,
  2. FutureOr<R> resolver(
    1. T val1,
    2. T val2
    )
)

Resolves this Future and other with resolver.

Implementation

Future<R> resolveBoth<R>(
    FutureOr<T> other, FutureOr<R> Function(T val1, T val2) resolver) {
  if (other is Future<T>) {
    return then((v1) {
      return other.then((v2) => resolver(v1, v2));
    });
  } else {
    return then((v1) {
      return resolver(v1, other);
    });
  }
}