forked from localvoid/timezone
-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Labels
needs infoThe issue needs more information to act onThe issue needs more information to act on
Description
Logs:
Error : LateInitializationError: Field '_local@890310200' has not been initialized. #0 _local (package:timezone/src/env.dart)
#1 local (package:timezone/src/env.dart:26:23)
#2 TZDateTime.isLocal (package:timezone/src/date_time.dart:121:43)
#3 TZDateTime.toLocal (package:timezone/src/date_time.dart:266:27)
The problem comes out to be in src/env.dart:
...
final _UTC = Location('UTC', [minTime], [0], [TimeZone.UTC]);
...
late Location _local;
...
/// Local Location
///
/// By default it is instantiated with UTC [Location]
Location get local => _local;
Location getLocation(String locationName) {
return _database.get(locationName);
}
void setLocalLocation(Location location) {
_local = location;
}
void initializeDatabase(List<int> rawData) {
_database.clear();
for (final l in tzdbDeserialize(rawData)) {
_database.add(l);
}
_local = _UTC;
}Why not directly assign _UTC to _local, and remove the late modifier. It is set as fallback already, or am I missing something?
Location _local = _UTC;Metadata
Metadata
Assignees
Labels
needs infoThe issue needs more information to act onThe issue needs more information to act on