todos-contra-el-fuego-mobile/lib/models/basicLocation.dart
vjrj 68ad4adbcf refactor: continue lint cleanup - 96 more issues fixed
- Add @immutable to classes with ==/hashCode (homePage, basicLocation, fireNotification, yourLocation, monitoredAreas)
- Fix camel_case_types (genericMap → GenericMap)
- Fix avoid_dynamic_calls (firesApi - typed responses)
- Fix use_build_context_synchronously (locationUtils)
- Fix always_put_control_body_on_new_line (4 reducers)
- Fix always_specify_types (placesAutocompleteUtils, reducers)
- Fix eol_at_end_of_file (4 files)
- Fix prefer_function_declarations_over_variables (introPage)
- Fix flutter_style_todos (fireMapReducer)

Build: APK generated, 0 errors, 0 warnings
2026-03-07 11:17:01 +01:00

39 lines
1 KiB
Dart

import 'package:meta/meta.dart';
@immutable
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,
};
}