Flutter is an open-source SDK developed to program applications to work on multiple operating systems using a single codebase such as Android, iOS, Linux, Mac, Windows, Google Fuchsia, and the web. Hence, save the developers time and manpower to write code for an app according to the specific OS. Flutter is developed by Google written in C, C++, and Dart.
- Flutter installation on Ubuntu 20.04 LTS Linux
- Use Snap to Install Flutter on Ubuntu 20.04 LTS
- 1. Run System update
- 2. Install Dependencies
- 3. Download Latest Flutter SDK
- 4. Install Flutter on Ubuntu 20.04 LTS
- 5. Add the flutter to the environment path
- 6. Check any missing dependency using- flutter doctor
- 7. Get Chrome browser
- 8. Install Android Studio on Ubuntu 20.04
- 9. Install Android SDK Command-line Tools (latest)
- 10. Add command-line tools to your environment
- 11. Agree to Android Licenses
- 11. Check Again Flutter requirements
- 12. Set up an editor
- 13. Create Flutter Project
Here we are using Ubuntu 20.04 to install the Flutter UI framework, however, the steps will be the same for Ubuntu 21.04 & 18.04 including Linux Mint, POP!OS, MX Linux, and other Debian-based systems.
- 64-bit Linux system
- 600 MB free Space at least
#Ist Method using Snap
Use Snap to Install Flutter on Ubuntu 20.04 LTS
If you don’t want to go through various steps to install and set up flutter then simply run the SNAP command, a single command will set all the necessary things required to start with this programming platform.
sudo snap install flutter --classic
To know where is Flutter SDK, run:
#2nd Method using Tarball file
1. Run System update
Let’s first run the system update command before installing Flutter, this will update all the already installed packages on our Ubuntu 20.04 Linux. In addition to refreshing the system repo cache.
sudo apt update
2. Install Dependencies
There are few tools and libraries required to use Flutter on Linux such as Ubuntu. Hence, before moving further use the below-given command to install them.
sudo apt install curl file git unzip xz-utils zip libglu1-mesa clang cmake ninja-build pkg-config libgtk-3-dev
Create a dedicated folder
Well, it’s a good idea to create a dedicated folder to store Flutter and avoid things from getting messed up. For example, let’s create a directory named- myproject you can use whatever you want.
3. Download Latest Flutter SDK
Next, we need the Flutter SDK tarball file. That we can easily download from its official webpage. Here is the link. Visit the page and select the latest version of Flutter to download.
4. Install Flutter on Ubuntu 20.04 LTS
Switch to the folder where you want to extract the downloaded flutter files. For example, here we have created a dedicated directory called- myproject and we are using that.
tar xvf ~/Downloads/flutter_linux_*-stable.tar.xz
In the above command, our downloaded Flutter tar file is inside the Downloads folder that is why we have given the path of that.
5. Add the flutter to the environment path
Well, to use the Flutter tool, we either have to switch to the extracted Flutter folder every time or need to mention its complete path. To remove this headache, simply add its bin directory to your environment path, so that you can access the Flutter globally anywhere on Terminal.
Edit bash profile
Here is the syntax to use:
Replace [path-to-flutter-directory] in the above command with the actual path of the folder where you have extracted the Flutter.
For example, here we have created a folder called
myproject and under it, we have extracted the folder. Hence the above command in our case will be:
At the end of the file add the PATH in the following format:
Save the file by pressing Ctrl+O and then Ctr+X.
Reload Terminal session
Now, refresh your current terminal session by closing and reopening the Terminal app as well.
Check whether your Flutter folder is in your Environment path or not
Once you confirmed the folder where you have extracted Flutter is in the Environment path, let’s verify Flutter command-line tools are working perfectly.
6. Check any missing dependency using- flutter doctor
Well, although we have completed the installation successfully along with the required dependencies. However, still in the case, something is missing to complete the setup, it can be pointed out using the Flutter’s doctor command:
In the below-given screenshot, you can see that we have two missing things we require for the full setup that is the Chrome browser, Android toolchain, and Android Studio. Let’s install them in the next step.
7. Get Chrome browser
Run the following commands to install the Chrome browser on your Ubuntu system.
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt update
sudo apt install google-chrome-stable
8. Install Android Studio on Ubuntu 20.04
Open your browser and Download Android Studio for Linux. Visit the official page and then select the Tarball file.
Once the downloading is completed, switch to the Downloads directory.
tar xvf android-studio-*-linux.tar.gz
Move extracted file to /opt directory.
sudo mv android-studio /opt/
Run Android Studio:
Next, simply follow the Wizard.
(optional) In case you want to create Android Studio Linux Desktop Shortcut and Command follow the link
9. Install Android SDK Command-line Tools (latest)
On your Android Studio Project, click on the File and then “Settings“.
Select Appearance & Behavior > System Settings > Android SDK > SDK Tools
Check the box given for “Android SDK Command-line Tools (latest)” and then press the OK button.
10. Add command-line tools to your environment
Edit Bash profile
At the end of the file add the following line
Save the file and reload the bash. Or simply close the Terminal and open it again.
11. Agree to Android Licenses
To use Flutter, the user must agree to the licenses of the Android SDK platform. Here is the command for the same:
flutter doctor --android-licenses
11. Check Again Flutter requirements
Let’s check again that Flutter dependencies are completed and the setup is successful.
12. Set up an editor
To set up the editor, go to Android Studio open any project, click on the File, and then select Settings.
There select “Plugins” and select Flutter to Install it.
13. Create Flutter Project
Now, create a New Flutter Project…
Select Flutter and set the full path to its SDK. For that Just enter the path of the folder where you have extracted the Flutter.
So, this was a quick tutorial to install Flutter on Ubuntu 20.04 Linux. Know more about it from the official documentation.