Flutter — Installation on Linux
Flutter is an open-source UI software development kit created by Google. It is used to develop applications for Android, iOS, Linux, Mac, Windows, Google, Fuchsia and the web from a single codebase. (Wikipedia)
Primarily, I use Flutter to develop mobile apps for Android and iOS devices. I found Flutter very easy compared to traditional Android Development. Flutter uses Dart as its primary language and we can develop apps by either using Android Studio or Visual Studio Code.
I am an open-source enthusiast and a full time Linux user, and during my initial Linux days, I faced many challenges while installing softwares on my Linux PC and other workarounds. I have already published another blog post on how to install Postman on Linux.
Anyway, in this post I am going to explain how to install Flutter and set it up on a Linux based machine. I personally use Manjaro KDE as my Linux distribution, but the process will be the same for any other distro.
- Log on to flutter.dev and click on the Get Started button. Click on Linux and scroll down to the Install Flutter manually section. Next, click on the tar.xz file provided there, your download will start.
2. While the Flutter SDK is downloading, open a new tab and download Android Studio.
Please see that you have sufficient amount of download data left, because Android Studio requires a huge amount of data to install and update.
3. I have moved my files from the Downloads folder to the Apps folder in my home directory.
4. Next, move into your Apps directory and fire up a terminal. Using the tar xf command, extract the flutter SDK (or you can use any other way of extracting the files, I use the terminal because it makes me feel powerful).
[faran@megatron Apps]$ tar xf flutter_linux_1.22.4-stable.tar.xz
Wait for a few seconds until the extraction is complete, you’ll get a new folder in your Apps directory with the same name.
5. In this step, we are going to add path to the Flutter SDK, so that we can access Flutter from anywhere in our PC.
For this, navigate to the home directory, and make sure that you can see the hidden files and folders. Search for the file named .bash_profile. If you don’t have this file, create it. Open it using any editor. Go to the last line and add the path to your bin directory as such:
Save the file and close it.
6. Navigate to the home directory and execute the source command on your .bash_profile file as such:
[faran@megatron ~]$ source /home/faran/.bash_profile
7. Run the flutter doctor command.
In the next steps, we are going to set up Android Studio.
8. Navigate back to the Apps folder and unzip the Android Studio zip file that we had downloaded.
9. Open the extracted folder, go to bin and run the studio.sh file.
Running this command will launch Android Studio. You’ll see the splash screen followed by the setup wizard.
The downloads will take a few minutes depending on your bandwidth and speed.
Android Studio doesn’t come with Flutter support natively, so we need to install the Flutter plugin. For this, click on Configure>Settings.
10. Click on Plugins and search for flutter.
This will install Flutter and ask you to restart the IDE (You will also be prompted to install Dart, just accept it).
11. Create a new Flutter project and use the standard options.
12. Once you see the Creating Flutter Project window, you’re good to go.
After it finishes, you’ll see the Android Studio main screen.