maybeWhen<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.')
- T rectangle(
- RectangleRegion rectangle
- T circle(
- CircleRegion circle
- T line(
- LineRegion line
- T customPolygon(
- CustomPolygonRegion customPolygon
- T multi(
- MultiRegion multi
Output a value of type T the type of this region
If the specified method is not defined for the type of region which this
region is, null will be returned.
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? maybeWhen<T>({
T Function(RectangleRegion rectangle)? rectangle,
T Function(CircleRegion circle)? circle,
T Function(LineRegion line)? line,
T Function(CustomPolygonRegion customPolygon)? customPolygon,
T Function(MultiRegion multi)? multi,
}) =>
switch (this) {
RectangleRegion() => rectangle?.call(this as RectangleRegion),
CircleRegion() => circle?.call(this as CircleRegion),
LineRegion() => line?.call(this as LineRegion),
CustomPolygonRegion() =>
customPolygon?.call(this as CustomPolygonRegion),
MultiRegion() => multi?.call(this as MultiRegion),
};