match<R> abstract method

R match<R>({
  1. required R some(
    1. T value
    ),
  2. required R none(),
})

Pattern matches this option.

final label = const Some<int>(42).match(
  some: (value) => 'count=$value',
  none: () => 'missing',
);

Implementation

R match<R>({
  required R Function(T value) some,
  required R Function() none,
});