when<T> method
- @Deprecated('Use a pattern matching selection pattern (such as `if case` or `switch`) ' 'instead. ' 'This is now a redundant method as the `BaseRegion` inheritance tree is ' 'sealed and modern Dart supports the intended purpose of this natively. ' 'This feature was deprecated in v10, and will be removed in a future ' 'version.')
- required T rectangle(
- RectangleRegion rectangle
- required T circle(
- CircleRegion circle
- required T line(
- LineRegion line
- required T customPolygon(
- CustomPolygonRegion customPolygon
- required T multi(
- MultiRegion multi
Output a value of type T the type of this region
Requires all region types to have a defined handler. See maybeWhen for the equivalent where this is not required.
Implementation
@Deprecated(
'Use a pattern matching selection pattern (such as `if case` or `switch`) '
'instead. '
'This is now a redundant method as the `BaseRegion` inheritance tree is '
'sealed and modern Dart supports the intended purpose of this natively. '
'This feature was deprecated in v10, and will be removed in a future '
'version.',
)
T when<T>({
required T Function(RectangleRegion rectangle) rectangle,
required T Function(CircleRegion circle) circle,
required T Function(LineRegion line) line,
required T Function(CustomPolygonRegion customPolygon) customPolygon,
required T Function(MultiRegion multi) multi,
}) =>
maybeWhen(
rectangle: rectangle,
circle: circle,
line: line,
customPolygon: customPolygon,
multi: multi,
)!;