when<R> method
R
when<R>({
- required R ifPointGraphic(
- PointGraphic feature
- required R ifPolylineGraphic(
- PolylineGraphic feature
- required R ifPolygonGraphic(
- PolygonGraphic feature
Implementation
R when<R>({
required R Function(PointGraphic feature) ifPointGraphic,
required R Function(PolylineGraphic feature) ifPolylineGraphic,
required R Function(PolygonGraphic feature) ifPolygonGraphic,
}) {
final self = this;
if (self is PointGraphic) {
return ifPointGraphic(self);
} else if (self is PolylineGraphic) {
return ifPolylineGraphic(self);
} else if (self is PolygonGraphic) {
return ifPolygonGraphic(self);
} else {
throw Exception("Unknown graphic $self");
}
}