okAsync<T2> method

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

If result is Err then returns this Err as is. If result is Ok then returns result of call await 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 =>
    then((resultT) async => Ok(await f(resultT.unwrap)));