Set up a flutter development environment on Linux

Flutter has been on top of the list of technologies I should learn. I found the setup of a flutter development environment a bit segmented and wanted to make life easier for others wanting to jump into flutter development.

This guide is distro-agnosti…


This content originally appeared on DEV Community and was authored by Martin Klingenberg

Flutter has been on top of the list of technologies I should learn. I found the setup of a flutter development environment a bit segmented and wanted to make life easier for others wanting to jump into flutter development.

This guide is distro-agnostic but is only confirmed to work on fedora 38.

Install android studio

I have had mixed success installing editors as flatpaks. Download android studio and unpack the tar https://developer.android.com/studio. Move the android studio files to a safe place. I choose $HOME/.android-studio. You can then start android studio by running \~/.android-studio/bin/studio.sh. Install flutter-plugin an in my case the ideaVIM-plugin.

When you have opened android-studio and done the setup, you can add a desktop entry. By clicking tools/Create Desktop Entry

Desktop entry can easily be created

Install Command-line-tools

Install the command line tools. These will come in handy when we set up flutter. Can be done as easily as this

Step one of adding command line tools

Step two of adding command line tools

Fetch some dependencies

RHEL Distros (Fedora, RedHat, CentOS)

sudo dnf install clang cmake ninja-build pkgconf-pkg-config gtk3-devel lzma-sdk-devel

Debian based distros (Ubuntu, Linux Mint etc)

sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev

Download the morst recent SDK

I would avoid using snap on Fedora and rather download the SDK and install manually. It is quite easy. Find the latest stable version here https://docs.flutter.dev/get-started/install/linux.

Extract and install

Personally I would just install this as I set up golang, basically just adding a folder to your home-directory.

cd; tar xf ~/Downloads/flutter_linux_[VERSION]]-stable.tar.xz

Update environment variables

If you use bash, execute the following to add flutter and android-commandline tools to the path

# IF YOU USE BASH
echo 'export PATH="$PATH:$HOME/flutter/bin"' >> $HOME/.bashrc
echo 'export PATH="$PATH:$HOME/Android/Sdk/cmdline-tools/latest/bin/"' >> $HOME/.bashrc

# IF YOU USE ZSH
echo 'export PATH="$PATH:$HOME/flutter/bin"' >> $HOME/.zshrc
echo 'export PATH="$PATH:$HOME/Android/Sdk/cmdline-tools/latest/bin/"' >> $HOME/.zshrc

# IF YOU USE FISH
echo 'set -xg PATH "$HOME/flutter/bin:$PATH"' >> $HOME/.config/fish/config.fish
echo 'set -xg PATH "$HOME/Android/Sdk/cmdline-tools/latest/bin:$PATH"' >> $HOME/.config/fish/config.fish

Agree to stuff you do not understand

If you want to do this step properly you should hire a lawyer and pay him what ever it takes to have him explain the terms of agreeing to the licsense

flutter doctor --android-licenses

And you are off to the races

Running the following command should give you an output looking like what I got below. And you should be able to launch your first app from android studio.

flutter doctor

Successful installation of flutter

I am really not a big fan of big editors and this article might get updated with a guide setting up the android SDK manually and use Emacs / VsCode / VIM instead.


This content originally appeared on DEV Community and was authored by Martin Klingenberg


Print Share Comment Cite Upload Translate Updates
APA

Martin Klingenberg | Sciencx (2023-04-30T11:15:11+00:00) Set up a flutter development environment on Linux. Retrieved from https://www.scien.cx/2023/04/30/set-up-a-flutter-development-environment-on-linux/

MLA
" » Set up a flutter development environment on Linux." Martin Klingenberg | Sciencx - Sunday April 30, 2023, https://www.scien.cx/2023/04/30/set-up-a-flutter-development-environment-on-linux/
HARVARD
Martin Klingenberg | Sciencx Sunday April 30, 2023 » Set up a flutter development environment on Linux., viewed ,<https://www.scien.cx/2023/04/30/set-up-a-flutter-development-environment-on-linux/>
VANCOUVER
Martin Klingenberg | Sciencx - » Set up a flutter development environment on Linux. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/30/set-up-a-flutter-development-environment-on-linux/
CHICAGO
" » Set up a flutter development environment on Linux." Martin Klingenberg | Sciencx - Accessed . https://www.scien.cx/2023/04/30/set-up-a-flutter-development-environment-on-linux/
IEEE
" » Set up a flutter development environment on Linux." Martin Klingenberg | Sciencx [Online]. Available: https://www.scien.cx/2023/04/30/set-up-a-flutter-development-environment-on-linux/. [Accessed: ]
rf:citation
» Set up a flutter development environment on Linux | Martin Klingenberg | Sciencx | https://www.scien.cx/2023/04/30/set-up-a-flutter-development-environment-on-linux/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.