match<R> abstract method

R match<R>({
  1. required R ok(
    1. T value
    ),
  2. required R err(
    1. E error
    ),
})

Pattern matches this result.

final label = const Ok<int, String>(42).match(
  ok: (value) => 'count=$value',
  err: (error) => error,
);

Implementation

R match<R>({
  required R Function(T value) ok,
  required R Function(E error) err,
});