I am writing this article to help anyone surfing through the internet for a proper guide to setup a smooth flutter dev work low for their Hyprland setups.
1. Install flutter through your package manager. If you're on Arch linux you can try following command.
yay -S flutter-bin # This will install dart and flutter from AUR
2. Install android-studio using your package manager. Again if on Arch, use below command.
yay -S android-studio # This will install android studio from AUR
3. Install flutter-tools neovim plugin to setup the LSP.
I assume you already know how to setup neovim plugins. Also this plugin will setup dart-ls automatically so don't install it through your lspconfig. flutter tools will give all of the functionalities Vs-code flutter extensions plus some additional stuff.
You can follow the repo's README to set this up accroding to your neovim setup.
- flutter-tools - https://github.com/nvim-flutter/flutter-tools.nvim
4. Now open android studio and create an emulator of your choice.
I recommend something above android 12 (S) as others will be x86 by default. Flutter will soon drop support for x86-based emulators or devices.
5. Once that done, next usual step is to run the emulator,
But android studio's emulator does not support native wayland as of now according to my findings.
MY WORKAROUND TO GET IT RUNNING:
You can use following command to force the current session of the emulator to run through Xwayland.
env QT_QPA_PLATFORM=xcb flutter emulators --launch <your-emulator-name>
If you're using fractional scaling or any scaling in Hyprland, the emulator will launch in a blurred window. To fix that add the following code to your hyprland.conf
xwayland {
force_zero_scaling = true
}
6. That's it!
You should be able to connect to the emulator using :FlutterRun
inside neovim. Other commands to control and access the flutter utilities can be found in the flutter-tools GitHub repo's README.
If you want a quick neovim setup or an entire hyprland setup with everything configured, you can use my neovim config in my dotfiles.
- My dotfiles - https://github.com/Chamal1120/dotfiles-linux-hyprland
Thank You chief for reading up to here
Feel free to ask me if anything is doubtful or let me know if there are better ways to do what I am doing right now. Comments are always welcome.
Top comments (0)