asyncOf<T extends Object, E extends Object> static method
Call the catching
function and produce a Future<Result<T, E>>
.
see also:
Result.of
Implementation
static Future<Result<T, E>> asyncOf<T extends Object, E extends Object>(
Future<T> Function() catching,
) async {
try {
return Ok(await catching());
} on E catch (e) {
return Err(e);
}
}