added toJson and fromJson functions
This commit is contained in:
@@ -11,4 +11,15 @@ class Location {
|
||||
|
||||
String get address => _address ?? '';
|
||||
LatLng get coordinates => _coordinates ?? LatLng.empty();
|
||||
|
||||
factory Location.fromJson(Map<String, dynamic> json) {
|
||||
return Location(
|
||||
address: json['address'] as String,
|
||||
coordinates: LatLng.fromJson(json['coordinates']),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'address': address, 'coordinates': coordinates};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user