when<T> method
T
when<T>({
- required T rectangle(
- DownloadableRegion<
RectangleRegion> rectangle
- DownloadableRegion<
- required T circle(
- DownloadableRegion<
CircleRegion> circle
- DownloadableRegion<
- required T line(
- DownloadableRegion<
LineRegion> line
- DownloadableRegion<
- required T customPolygon(
- DownloadableRegion<
CustomPolygonRegion> customPolygon
- DownloadableRegion<
Output a value of type T
dependent on originalRegion and its type R
Implementation
T when<T>({
required T Function(DownloadableRegion<RectangleRegion> rectangle)
rectangle,
required T Function(DownloadableRegion<CircleRegion> circle) circle,
required T Function(DownloadableRegion<LineRegion> line) line,
required T Function(DownloadableRegion<CustomPolygonRegion> customPolygon)
customPolygon,
}) =>
switch (originalRegion) {
RectangleRegion() => rectangle(_cast()),
CircleRegion() => circle(_cast()),
LineRegion() => line(_cast()),
CustomPolygonRegion() => customPolygon(_cast()),
};