resultFromAsyncFunc<T extends Object, E extends Object> function
Future<TaskResult<T, E> >
resultFromAsyncFunc<T extends Object, E extends Object>(
- FutureOr<
T> func()
Returns a result by executing given async function and catching current type of exception.
Implementation
Future<TaskResult<T, E>> resultFromAsyncFunc<T extends Object, E extends Object>(FutureOr<T> Function() func) async {
try {
return Ok(await func());
} on E catch (e) {
return Err(e);
}
}