Open behzodfaiziev opened 3 months ago
I still consider Linux my primary OS and I'd love to support it, but the sad fact is that I've been forced onto Apple hardware since I started developing Flutter apps. Today I don't have access to a machine where it's not a huge pain to set up Linux, even in a VM :/
That said, if anyone wanted to contribute support, I would be very happy.
Hi!
To run Linux on Apple hardware you just have to install the free UTM app and then select one of the Linux images from the gallery here: https://mac.getutm.app/gallery/ . It is free and just requires a few clicks to setup.
However, I have added support for Linux now using the Flutter tools to create the directory and file structure for Linux and Github Copilot for help with the actual implementation. I have tested it and it seems to work fine. You can find the Pull Request here:
https://github.com/tjarvstrand/flutter_timezone/pull/40
Is it good? You should be able to test it yourself using UTM as mentioned above. Thank you very much for maintaining this project! :-)
@dg76 What architecture are you on? I'm on an M1 and UTM seems to install a ARM64 build of Linux (naturally) and I don't seem to be able to run flutter on that.
@tjarvstrand It seems to work in the following way, I have tested it myself on my M1 MacBook:
sudo apt install clang cmake ninja-build pkg-config libgtk-3-dev git
git clone https://github.com/flutter/flutter.git
cd flutter/bin
./flutter
./flutter doctor
It will tell you that the Linux toolchain works fine. However Chrome and Android Studio are not installed and thus not found. From what I have read Android Studio is not available for aarch64 but VS Code is. So if you don't just want to build or test something but develop using this system you could install VS Code. However, I think for development it is better to just use Flutter directly on macOS.
Anyway, you can install VS Code using these commands:
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /usr/share/keyrings/microsoft-archive-keyring.gpg
sudo sh -c 'echo "deb [arch=arm64 signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get update
sudo apt-get install code
Inside VS Code you can then install the Flutter extension. Then press CTRL-SHIFT-P and type "Flutter: New Project" to create a new project. When you have finished this and try to start it you can select "Linux desktop" as target and it runs fine. So you could use VS Code for development and run at least apps with the Linux target or using physical Android devices. And if you install Chrome you can probably also use Flutter Web.
I have tested all these steps myself now and they work fine. I was able to run a Flutter app started using VS Code on Linux inside UTM on my Mac M1. It might also work to install an Android emulator but I haven't tried that so far.
But usually I develop with Flutter directly on macOS and additionally I have a Linux PC (x86_64).
I hope this is useful. 😊 I found most of the information above using ChatGPT and Perplexity.ai .
Feature
The
flutter_timezone
package currently offers timezone functionality for iOS, Android, macOS, Windows, and web platforms. However, it does not yet support Linux, which limits its usefulness for developers building cross-platform applications that include Linux as a target.Adding Linux support would enable consistent timezone features across all major platforms, including desktop environments, and would enhance the package’s versatility and adoption within the Flutter community.
I kindly request the addition of Linux support, or any guidance on how this could be implemented. Your efforts to expand the platform compatibility of this package would be greatly appreciated. Thank you!