executeProtectedAsync<S> function

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

Async version of executeProtected

Implementation

FutureResult<S, Object> executeProtectedAsync<S>(
    Future<S> Function() func) async {
  assert(S is! Result, "Use executeProtectedAsyncResult instead");
  try {
    return Ok(await func());
  } catch (e) {
    return Err(e);
  }
}