when method
void
when({
- required void onPoint(
- Point value
- required void onPolyline(
- Polyline value
- required void onPolygon(
- Polygon value
- required void onMultiPolygon(
- MultiPolygon value
- required void onBoundingBox(
- BoundingBox value
- required void onCircle(
- Circle value
Applies the passed function to the variant value.
Implementation
void when({
required void Function(mapkit_geometry_point.Point value) onPoint,
required void Function(Polyline value) onPolyline,
required void Function(Polygon value) onPolygon,
required void Function(MultiPolygon value) onMultiPolygon,
required void Function(BoundingBox value) onBoundingBox,
required void Function(Circle value) onCircle,
}) {
if (_value is mapkit_geometry_point.Point) {
return onPoint(_value as mapkit_geometry_point.Point);
}
if (_value is Polyline) {
return onPolyline(_value as Polyline);
}
if (_value is Polygon) {
return onPolygon(_value as Polygon);
}
if (_value is MultiPolygon) {
return onMultiPolygon(_value as MultiPolygon);
}
if (_value is BoundingBox) {
return onBoundingBox(_value as BoundingBox);
}
if (_value is Circle) {
return onCircle(_value as Circle);
}
assert(false);
}