todos-contra-el-fuego-mobile/lib/models/basicLocation.dart
vjrj 7a4c9fb3bc fix: resolve 2 remaining strict analysis errors
- introPage.dart: Convert fireItems to proper static function closure
- mainDrawer.dart: Convert unreadCount int to String for Text widget
2026-03-06 11:21:06 +01:00

36 lines
982 B
Dart

class BasicLocation implements Comparable<BasicLocation> {
// static BasicLocation noLocation = new BasicLocation(lat: 0.0, lon: 0.0);
BasicLocation({required this.lat, required this.lon, this.description});
BasicLocation.fromJson(Map<String, dynamic> json)
: lat = (json['lat'] as num).toDouble(),
lon = (json['lon'] as num).toDouble(),
description = json['description'] as String?;
final double lat;
final double lon;
final String? description;
@override
int compareTo(BasicLocation other) {
return lat == other.lat && lon == other.lon ? 1 : 0;
}
@override
bool operator ==(Object o) => o is BasicLocation && o.lat == lat && o.lon == lon;
@override
int get hashCode {
int hash = 1;
hash = hash * 17 + lat.hashCode;
hash = hash * 31 + lon.hashCode;
return hash;
}
Map<String, dynamic> toJson() => <String, dynamic>{
'lat': lat,
'lon': lon,
'description': description,
};
}