toJson method
Construct JSON from the elevation data, as per the schema in the api documentation.
The json will have keys 'timestamp', 'attribution', 'version', 'elevation' and 'geometry' which corresponds to a Map further containing keys 'coordinates' and 'type'.
Implementation
Map<String, dynamic> toJson() => <String, dynamic>{
'attribution': attribution,
'geometry': <String, dynamic>{
'coordinates':
coordinates.map<List<double>>((dynamic e) => e.toList()).toList(),
'type': type,
},
'timestamp': timestamp,
'version': version,
};