refactored location model

This commit is contained in:
2026-06-18 18:17:30 +02:00
parent 18ce2d9ccf
commit 7b9188e2e8
+3 -9
View File
@@ -1,16 +1,10 @@
import 'latlng.dart'; import 'latlng.dart';
class Location { class Location {
final String? _address; final LatLng coordinates;
final LatLng? _coordinates; final String address;
Location({this._address, this._coordinates}); Location({required this.coordinates, this.address = ''});
Location.fromAddress({required this._address}) : _coordinates = null;
Location.fromCoordinates({required this._coordinates}) : _address = null;
String get address => _address ?? '';
LatLng get coordinates => _coordinates ?? LatLng.empty();
factory Location.fromJson(Map<String, dynamic> json) { factory Location.fromJson(Map<String, dynamic> json) {
return Location( return Location(