added toJson and fromJson functions

This commit is contained in:
marco committed 2026-06-12 12:11:41 +02:00
1 parent 35f26112af
commit 1bb9fdbb18
3 files changed
+63

No files matched your search

+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};
}
}