when<R> method
Invokes either ok
or err
depending on the result.
Identical to match except that the arguments are named.
Implementation
Future<R> when<R>({required R Function(T) ok, required R Function(E) err}) =>
then((result) => result.when(ok: ok, err: err));