import 'package:meta/meta.dart'; @immutable class BasicLocation implements Comparable { // static BasicLocation noLocation = new BasicLocation(lat: 0.0, lon: 0.0); const BasicLocation({required this.lat, required this.lon, this.description}); BasicLocation.fromJson(Map 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 toJson() => { 'lat': lat, 'lon': lon, 'description': description, }; }