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 2.* installation on Ubuntu 20.04 LTS Linux
Here we are using Ubuntu 20.04 LTS to install the Flutter UI framework, however, the steps will be the same for Ubuntu 21.04 & 18.04
2 Ways to install Flutter on Ubuntu Linux OS
- Using Snap to Install Flutter
- anual SDK Install Flutter
Here we are using snap installing flutter
First we have to install Snap if you already have Snap install skip this step and Follow the next step.
The easiest way to install Flutter on Linux is by using snapd. For more information, see Installing snapd.
Install Flutter using snapd
$ sudo snap install flutter --classic
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.
Add the flutter tool to your path:
$ export PATH="$PATH:`pwd`usr/local/development/flutter/bin"
After export path 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
echo $PATH
Here we are using manually installing flutter
Download the following installation bundle to get the latest stable release of the Flutter SDK:
we need the Flutter SDK 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.
Switch to the folder where you want to extract the downloaded flutter SDK files. For example, here we have created a dedicated directory called- development and we are using that.
Extract and move the file in the desired location, for example:
Now we have extracted a SDK in the download folder manually or by command , after that we have to keep the SDK in one place. For which we make a folder so that we can keep it inside
$ sudo mv usr/local/development/flutter
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.
Add the flutter tool to your path:
$ export PATH="$PATH:`pwd`usr/local/development/flutter/bin"
After export path 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
echo $PATH
Once you confirmed the folder where you have extracted Flutter is in the and setup Environment path, let’s verify Flutter command-line tools are working perfectly.
flutter --version
Check any missing dependencies in- flutter doctor
Well, although we have completed the flutter 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:
flutter doctor