How to install Flutter on Ubuntu 20.04 |18.04 | 21.04 Linux – Guide
Flutter is an open source SDK designed to program applications that work on multiple operating systems using a single code base, such as Android, iOS, Linux, Mac, Windows, Google Fuchsia and the web. Therefore, save developers time and labor to code an application according to the specific operating system. Flutter is developed by Google written in C, C++ and Dart.
Flutter Installation on Ubuntu 20.04 LTS Linux
Here, we are using Ubuntu 20.04 to install the Flutter UI framework, however the steps will be the same for Ubuntu 21.04 and 18.04, including Linux Mint, POP! OS, MX Linux and other Debian-based systems.
Requirements
#Ist Method using Snap
Use Snap to install Flutter on Ubuntu 20.04 LTS If you don’t want to go through several steps to install and set up flutter then simply run the SNAP command, a single command will define all the things needed to get started with this programming platform. sudo snap install flutter – classic To find out where the Flutter SDK is, run: flutter sdk-path
#2 Method using Tarball file
- Run system update Let’s first run the system update command before installing Flutter, this will update all packages already installed on our Ubuntu 20.04 Linux. In addition to updating the system repo cache. sudo apt update
- Install dependencies There are some tools and libraries needed to use Flutter on Linux, such as Ubuntu. Therefore, before proceeding, use the command given below to install them. sudo apt install file curl 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 keep things from getting messy up. For example, let’s create a directory called -myproject that you can use whatever you like. mkdir myproject
- Download the latest Flutter SDK Next, we need the Flutter SDK tarball file. This we can easily download from their official page. Here is the link. Visit the page and select the latest version of Flutter to download. Download the latest version of Flutter SDK for Linux
- Install Flutter on Ubuntu 20.04 LTS Change to the folder where you want to extract the downloaded flutter files. For example, here we have created a dedicated directory called -myproject and are using it. cd my project Extract files tar xvf ~ / Downloads / flutter_linux _ * – stable.tar.xz In the above command, our downloaded Flutter tar file is inside the Downloads folder, that’s why we’ve provided the path to this.
- Add vibration to the environment path Well, to use the Flutter tool, we have to change to the extracted Flutter folder every time or we need to mention its full path. To remove this headache, just add your bin directory to the environment path, so you can access Flutter globally from anywhere in Terminal. Edit bash profile year ~ / .bashrc This is the syntax to use: export PATH = “$ PATH:[path-to-flutter-directory]/ bin ” To replace [path-to-flutter-directory] in the command above with the actual path of the folder where you extracted Flutter. For example, here we create a folder called myproject and under that we extract the folder. Therefore, the above command in our case will be: nano ~ / .bashrc At the final from the file, add the PATH in the following format: export PATH = “$ PATH: ~ / myproject / flutter / bin” Save the file by pressing Ctrl + O and then Ctrl + X. Reload Terminal Session Now update your current terminal session by closing and reopening the Terminal app as well. Check if your Flutter folder is in your environment path or not echo $PATH After confirming that the folder where you extracted Flutter is in the environment path, let’s verify that Flutter’s command line tools are working perfectly. vibration – version Check Flutter Version
- Check for any missing addictions using the flutter doctor Well, although we have successfully completed the installation along with the necessary dependencies. However, even in this case, something is missing to complete the configuration, this can be pointed out using Flutter’s medical command: throbbing doctor In the screenshot provided below, you can see that we are missing two things we need for the full setup: the Chrome browser, the Android toolset, and the Android Studio. Let’s install them in the next step. Flutter Doctor on Ubuntu to check for errors
- Get the Chrome browser Run the following commands to install 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
- Install Android Studio on Ubuntu 20.04 Open your browser and download Android Studio for Linux. Visit the official page and select the Tarball archive. Download Android Studio for Linux Once the download is complete, go to the Downloads directory. cd downloads Extract file: tar xvf android-studio – * – linux.tar.gz Move the extracted file to the /opt directory. sudo mv android-studio / opt / Run Android Studio: /opt/android-studio/bin/./studio.sh Then just follow the wizard. (optional) If you want to create the Linux desktop shortcut and command in Android Studio, follow the link
- Install Android SDK Command Line Tools (latest) In your Android Studio project, click on File and then on “Settings“. Android Studio Settings Select Appearance & Behavior > System Settings > Android SDK > SDK Tools Check the box provided for “Android SDK Command Line Tools (Latest)” and press the OK button button. Install the Android SDK Command Line Tools
- Add command line tools to your environment Edit Bash Profile nano ~ / .bashrc At the final from the file, add the following line export PATH = $PATH: ~ / Android / Sdk / cmdline-tools / latest / bin Save the file and reload bash. Or simply close Terminal and open it again. source ~ / .bashrc
- Agree to Android licenses To use Flutter, the user must agree to the Android SDK platform licenses. Here is the command for it: flutter doctor – android-licenses Flutter Acceptance License
- Recheck vibration requirements Let’s double check that the Flutter dependencies were completed and the setup was successful. throbbing doctor Flutter installed Ubuntu 20.04
- Define up an editor Per up the editor, go to Android Studio, open any project, click File and select Settings. There select “Plugins” and select Flutter to install it. Install the Flutter plugin
- Create Flutter Project Now create a new vibration project… Create New Flutter Project Select Flutter and set the full path to your SDK. To do this, just enter the path to the folder where you extracted Flutter. Set Flutter SDK Path So this was a quick tutorial to install Flutter on Ubuntu 20.04 Linux. Find out more in the official documentation.
Final note
I hope you like the guide How to install Flutter on Ubuntu 20.04 |18.04 | 21.04 Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.