| 12345678910111213141516171819202122 |
- /// A one-shot location fix plus a best-effort place label.
- class LocationReading {
- const LocationReading({
- required this.latitude,
- required this.longitude,
- required this.place,
- });
- final double latitude;
- final double longitude;
- final String place;
- factory LocationReading.fromMap(Map<dynamic, dynamic> map) {
- return LocationReading(
- latitude: (map['latitude'] as num?)?.toDouble() ?? 0,
- longitude: (map['longitude'] as num?)?.toDouble() ?? 0,
- place: ((map['place'] as String?) ?? '').trim(),
- );
- }
- String get displayPlace => place.isEmpty ? 'Current location' : place;
- }
|