Dart?flutter does not appear to allow a timezone (eg: \"Australia/Sydney\" or \"America/Detroit\") to be specified when creating a DateTime object. Either the local timezone
The TimeZone package does work. From the issues list on GitHub:
Sorry this took 6 months but I have a good solution. I think it will be the recommended solution.
See Flutter's docs on Adding Assets. You should be able to add to your Flutter app's pubspec.yaml:
flutter:
assets:
- packages/timezone/lib/data/2015b.tzf
and load in your app with:
Future> loadDefaultData() async {
var byteData = await rootBundle.load('packages/timezone/data/2015b.tzf');
return byteData.buffer.asUint8List();
}
// Call the above with something like:
loadDefaultData().then((rawData) {
initializeDatabase(rawData);
var zurich = getLocation('Europe/Zurich');
});