toJson method
Returns a GeoJSON representation of the LineString
Example:
LineString([Coordinate(1, 2), Coordinate(3, 4)]).toJson(); // {'type': 'Feature', 'geometry': {'type': 'LineString', 'coordinates': [[1, 2], [3, 4]]}, 'properties': {}}
Implementation
@override
Map<String, dynamic> toJson() {
return {
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': coordinates.map((c) => c.toJson()).toList()
},
'properties': properties,
};
}