resolveWith<R> method

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

Resolves this instance with resolver result.

Implementation

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

  if (self is Future<T>) {
    return self.then((r) => resolver());
  } else {
    return resolver();
  }
}