capture<T> method
Null safety
- 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) => ValueResult(value),
onError: (Object error, StackTrace stackTrace) =>
ErrorResult(error, stackTrace));
}