when<R> method

  1. @override
R when<R>({
  1. required R success(
    1. T data
    ),
  2. required R error(
    1. Failure failure
    ),
})
override

Pattern-matches on the variant, calling success or error and returning the produced value.

Implementation

@override
R when<R>({
  required R Function(T data) success,
  required R Function(Failure failure) error,
}) =>
    error(failure);