todos-contra-el-fuego-mobile/lib/models/basicLocation.dart
vjrj 8da3752193 Fix 23 additional lint issues to reduce from 129 to 106 issues
- Add const constructors to @immutable classes (5 issues: prefer_const_constructors_in_immutables)
- Fix nullable value casts in firesApi.dart (3 issues: cast_nullable_to_non_nullable)
- Remove redundant default argument values (2 issues: avoid_redundant_argument_values)
- Make YourLocation immutable with final fields (2 issues: avoid_equals_and_hash_code_on_mutable_classes)
- Update imports and fix formatting

Reduces lint issues from 129 to 106. APK builds successfully (146 MB).
2026-03-11 23:45:06 +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);
const 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,
};
}