deserialize static method
Implementation
static GeometryType deserialize(Map<String, dynamic> json) {
GeoJSONObjectType decoded = json['type'] is GeoJSONObjectType
? json['type']
: $enumDecode(_$GeoJSONObjectTypeEnumMap, json['type']);
switch (decoded) {
case GeoJSONObjectType.point:
return Point.fromJson(json);
case GeoJSONObjectType.multiPoint:
return MultiPoint.fromJson(json);
case GeoJSONObjectType.lineString:
return LineString.fromJson(json);
case GeoJSONObjectType.multiLineString:
return MultiLineString.fromJson(json);
case GeoJSONObjectType.polygon:
return Polygon.fromJson(json);
case GeoJSONObjectType.multiPolygon:
return MultiPolygon.fromJson(json);
case GeoJSONObjectType.geometryCollection:
throw Exception(
'This implementation does not support nested GeometryCollections');
default:
throw Exception('${json['type']} is not a valid GeoJSON type');
}
}