deserialize method

Map<String, Object?> deserialize(
  1. String js
)

Implementation

Map<String, Object?> deserialize(String js) {
  Map<String, dynamic> o = _jsonToObject(js);
  String geomType = _parseGeometryType(o['geometryType']);

  List<Map<String, Object?>> features = <Map<String, Object?>>[];
  List<Map<String, Object?>> o2 = o['features'] as List<Map<String, Object?>>;
  for (
    dynamic i = 0,
        feature = <String, Object?>{
          'string': '',
          'int': 0,
          'object': <String, Object?>{},
          'null': null,
        };
    i < o2.length;
    i++
  ) {
    // prepare the main parts of the GeoJSON
    feature = o2[i];
    Map<String, Object?> feat = _featureToGeo(feature, geomType);
    features.add(feat);
  }

  Map<String, Object?> featColl = <String, Object?>{};
  featColl['type'] = "FeatureCollection";
  featColl['features'] = features;

  return featColl;
}