capture<T> method

Future<Result<T>> capture <T>(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((value) => new ValueResult(value),
      onError: (error, stackTrace) => new ErrorResult(error, stackTrace));
}