okAsync<T2> method

Future<Result<T2>> okAsync<T2>(
  1. Future<T2> f(
    1. T
    )
)

The same as ok(), but wrapped with Future<...>. If result is Err then returns this Err as is. If result is Ok then returns result of call f(result.val). Result of call f() must be a value of type T2.

Implementation

Future<Result<T2>> okAsync<T2>(Future<T2> Function(T) f) async {
  return isErr ? Err<T2>(err) : Ok(await f(unwrap));
}