maybeWhen<T> method
T?
maybeWhen<T>({
- T rectangle(
- DownloadableRegion<
RectangleRegion> rectangle
- DownloadableRegion<
- T circle(
- DownloadableRegion<
CircleRegion> circle
- DownloadableRegion<
- T line(
- DownloadableRegion<
LineRegion> line
- DownloadableRegion<
- T customPolygon(
- DownloadableRegion<
CustomPolygonRegion> customPolygon
- DownloadableRegion<
- T multi(
- DownloadableRegion<
MultiRegion> multi
- DownloadableRegion<
Output a value of type T dependent on originalRegion and its type R
If the specified method is not defined for the type of region which this
region is, null will be returned.
Implementation
T? maybeWhen<T>({
T Function(DownloadableRegion<RectangleRegion> rectangle)? rectangle,
T Function(DownloadableRegion<CircleRegion> circle)? circle,
T Function(DownloadableRegion<LineRegion> line)? line,
T Function(DownloadableRegion<CustomPolygonRegion> customPolygon)?
customPolygon,
T Function(DownloadableRegion<MultiRegion> multi)? multi,
}) =>
switch (originalRegion) {
RectangleRegion() => rectangle?.call(cast()),
CircleRegion() => circle?.call(cast()),
LineRegion() => line?.call(cast()),
CustomPolygonRegion() => customPolygon?.call(cast()),
MultiRegion() => multi?.call(cast()),
};