fromJson static method

GeoJSONObject fromJson(
  1. Map<String, dynamic> json
)

Implementation

static GeoJSONObject fromJson(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:
      return GeometryCollection.fromJson(json);
    case GeoJSONObjectType.feature:
      return Feature.fromJson(json);
    case GeoJSONObjectType.featureCollection:
      return FeatureCollection.fromJson(json);
  }
}