capture<T> static method

Future<Result<T>> capture<T>(
  1. Future<T> future
)

Captures the result of a future into a Result future.

The resulting future will never have an error. Errors have been converted to an ErrorResult value.

Implementation

static Future<Result<T>> capture<T>(Future<T> future) {
  return future.then(ValueResult.new, onError: ErrorResult.new);
}