Open SteveAlexander opened 5 years ago
I had the same problem when executing the following code on an android emulator:
await TimeMachine.initialize({
'rootBundle': rootBundle,
'timeZone': await FlutterNativeTimezone.getLocalTimezone(),
});
The exception occurred because FlutterNativeTimezone.getLocalTimezone()
returned GMT, which could not be resolved by TimeMachine
. To fix this, I now manually change GMT to UTC:
var timeZone = await FlutterNativeTimezone.getLocalTimezone();
if (timeZone == 'GMT') {
timeZone = 'UTC';
}
await TimeMachine.initialize({
'rootBundle': rootBundle,
'timeZone': timeZone,
});
This was reported via Sentry.io, with an app that is using
flutter_native_timezone
.The problem is in vm.dart, line 91
Getting
local.id
fails becauselocal
isnull
.I think the culprit is
tzdb.getZoneOrNull
that might return null.I guess if it returns null, Perhaps timemachine should log a warning message, and then resort to
_figureOutTimeZone