Closed D-Elyes closed 1 year ago
This is because the tool which builds the timezone database relies on an application called zic
, which is not included in Windows. So, as far as I know, this is a Windows only issue.
Here's what I did to work around the issue. On Windows 10, install / fire up Ubuntu on Windows Subsystem for Linux (WSL). Then in the ubuntu shell window:
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
sudo apt-get install dart
echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.profile
Close the Ubuntu / WSL window, and open it up again, so the PATH changes are applied.
git clone https://github.com/srawlins/timezone.git
cd timezone
pub run tool/get -s 2020a
2020a
with the latest versionThe timezone databases are generated and stored in lib/data in the timezone folder on WSL, so copy them from the WSL filesystem to your flutter project on your Windows file system. I chose to put them in a folder called assets
in the root of my project:
mv lib/data/2020a* /mnt/d/code/my-flutter-project/assets/timezone/
2020a
with whatever version you used earlier*
to copy all three at the same time - you may only want to copy one of them/mnt/d/code/my-flutter-project
is the location of my flutter project on my Windows D drive, so change as necessaryAdd the database asset in pubsepc.yaml
:
assets:
- assets/timezone/2020a.tzf
2020a.tzf
version, change as necessary (see here for an explanation)The rest should work as per the instructions for the timezone package. For example, initialise the library:
var byteData = await rootBundle.load('assets/timezone/2020a.tzf');
initializeDatabase(byteData.buffer.asUint8List());
A link to this guide should be totally added to the documentation.
Hello, i encounter this error when running
flutter pub run tool/get -s 2019c