refactored location model
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
import 'latlng.dart';
|
||||
|
||||
class Location {
|
||||
final String? _address;
|
||||
final LatLng? _coordinates;
|
||||
final LatLng coordinates;
|
||||
final String address;
|
||||
|
||||
Location({this._address, this._coordinates});
|
||||
|
||||
Location.fromAddress({required this._address}) : _coordinates = null;
|
||||
Location.fromCoordinates({required this._coordinates}) : _address = null;
|
||||
|
||||
String get address => _address ?? '';
|
||||
LatLng get coordinates => _coordinates ?? LatLng.empty();
|
||||
Location({required this.coordinates, this.address = ''});
|
||||
|
||||
factory Location.fromJson(Map<String, dynamic> json) {
|
||||
return Location(
|
||||
|
||||
Reference in New Issue
Block a user