resolvable method

Resolvable<T> resolvable()

Returns a Resolvable that provides access to the completer's result.

If the completer has already been resolved synchronously, this will return a Sync with the value. Otherwise, it returns an Async containing the completer's future.

Implementation

@pragma('vm:prefer-inline')
Resolvable<T> resolvable() {
  return Resolvable(() {
    switch (_value) {
      case Some(value: final okValue):
        return okValue;
      case None():
        return _completer.future;
    }
  });
}