when<R> method

Future<R> when<R>({
  1. required R some(
    1. T
    ),
  2. required R none(),
})

Invokes either some or none depending on the option.

Identical to match except that the arguments are named.

Implementation

Future<R> when<R>({
  required R Function(T) some,
  required R Function() none,
}) =>
    matchAsync(some, none);