added toJson and fromJson functions

This commit is contained in:
2026-06-12 12:11:41 +02:00
parent 35f26112af
commit 1bb9fdbb18
3 changed files with 63 additions and 0 deletions
+11
View File
@@ -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};
}
}