GeoJSONGeometry.fromMap constructor

GeoJSONGeometry.fromMap(
  1. Map<String, dynamic> map
)

Creates a new instance of GeoJSONGeometry from a Map object.

The Map must contain a 'type' key with one of the valid GeoJSON Geometry types.

Implementation

factory GeoJSONGeometry.fromMap(Map<String, dynamic> map) {
  assert(map.containsKey('type'), 'There MUST be contains key `type`');
  assert(
      [
        'Point',
        'MultiPoint',
        'LineString',
        'MultiLineString',
        'Polygon',
        'MultiPolygon',
        'GeometryCollection'
      ].contains(map['type']),
      'Invalid type');
  return GeoJSON.fromMap(map) as GeoJSONGeometry;
}