when method

void when({
  1. required void onPoint(
    1. Point value
    ),
  2. required void onPolyline(
    1. Polyline value
    ),
  3. required void onPolygon(
    1. Polygon value
    ),
  4. required void onMultiPolygon(
    1. MultiPolygon value
    ),
  5. required void onBoundingBox(
    1. BoundingBox value
    ),
  6. required void onCircle(
    1. 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);
}