GeoJSONFeature.fromMap constructor

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

The constructor from map

Implementation

factory GeoJSONFeature.fromMap(Map<String, dynamic> map) {
  assert(map.containsKey('type'), 'There MUST be contains key `type`');
  assert(['Feature'].contains(map['type']), 'Invalid type');
  assert(
      map.containsKey('geometry'), 'There MUST be contains key `geometry`');
  assert(map['geometry'] is Map, 'There MUST be geometry object.');
  return GeoJSONFeature(
    GeoJSONGeometry.fromMap(map['geometry']),
    properties:
        map['properties'] != null ? Map.castFrom(map['properties']) : null,
    id: map['id'],
    title: map['title'],
  );
}