toJson method
Converts the FeatureCollection to a GEOJSON FeatureCollection object.
Example:
FeatureCollection([
Point(Coordinate(1, 2)),
Point(Coordinate(3, 4))
]).toJson(); // {'type': 'FeatureCollection', 'features': [{'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [1, 2]}, 'properties': {}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [3, 4]}, 'properties': {}}]}
Implementation
Map<String, dynamic> toJson() {
return {
'type': 'FeatureCollection',
'features': features.map((f) => f.toJson()).toList(),
};
}