wrapAsync<T> static method
Compute a Future value using compute
and wrap the result in a Maybe.
compute
is called to compute a Future value.- The Future is awaited.
- The result is wrapped in a Maybe as if by Maybe.wrap
Implementation
static Future<Maybe<T>> wrapAsync<T>(Future<T> Function() compute) async {
try {
return Maybe(await compute());
}
catch (e, trace) {
return Maybe.error(e, trace);
}
}