fix: lazy initialize YourLocation.noLocation to prevent LateInitializationError

The static field 'noLocation' was never initialized after removing the
_initNoLocation() function. Changed to a lazy getter that initializes
on first access to prevent runtime crash.
This commit is contained in:
vjrj 2026-03-06 23:03:00 +01:00
parent 35d6b33c5f
commit 948a609619

View file

@ -29,7 +29,12 @@ class YourLocation {
int distance;
late int currentNumFires;
static late final YourLocation noLocation;
static YourLocation get noLocation {
_noLocation ??= YourLocation(id: ObjectId(), lat: 0.0, lon: 0.0);
return _noLocation!;
}
static YourLocation? _noLocation;
static const int? withoutStats = null;
Map<String, dynamic> toJson() => _$YourLocationToJson(this);