guardAsyncResult<S> function

FutureResult<S, Object> guardAsyncResult<S>(
  1. Future<Result<S, Object>> func()
)

Async version of guardResult

Implementation

@pragma("vm:prefer-inline")
FutureResult<S, Object> guardAsyncResult<S>(
    Future<Result<S, Object>> Function() func) async {
  try {
    return await func();
  } catch (e) {
    return Err(e);
  }
}