Mobile applications continued to become more and more popular.
Fortunately there are many programming tools available to developers who want to create them. Among these tools there is Flutter, which has distinguished itself lately.
Flutter is a free and open-source mobile UI framework created by Google and released in May 2017. Using Fultter you can build beautiful, natively compiled applications for mobile, web, desktop, and embedded devices from a single codebase.
In short you can use one programming language and one codebase to create two different apps (for Android and iOS).
Flutter is a modern framework, and you can feel it!
It’s way simpler to create mobile applications with it. If you have used Java, Swift, or React Native, you’ll notice how Flutter is different.
I personally never liked mobile application development before I started using Flutter. What I love about Flutter is that you can create a real native application without a bunch of code.
Google uses Flutter for various Google Assistant modules and the Google Home Hub user interface. Moreover, there are already 50,000 Flutter apps available in the Google Play Store, and this number is increasing at a high rate.
Alibaba Group, eBay, Groupon, and other popular e-commerce providers use Flutter as well to give their web and mobile applications uniform looks.
Key Features of Flutter
- Both Flutter and Dart are open-source and free to use and provides extensive documentation and community support to help out with any issues you may encounter.
- Flutter uses Dart as an object-oriented programming language to create apps. The prominent features of Dart include a rich standard library, garbage collection, strong typing, generics, and async-awaits.
- The core idea of the Flutter platform is based on widgets. Developers can make an elegant and expressive UI by combining different widgets in line with the client’s business model.
- Excellent and innovative features including Hot Reload and a single codebase for Android and iOS platforms can enable developers to build a feature-rich Flutter app in a short time.
- When you hire mobile app developers to build applications on Flutter, you get fast execution on any platform. This is because it uses Dart programming language, which is fast, simple, and can easily compile into native code.
- Normally testing would require checking on compatibility on different platforms. With Flutter, apps use a single code base with no change to run across different platforms.
To install and run Flutter, your development environment must meet these minimum requirements.
- Disk Space: 600 MB (does not include disk space for IDE/tools).
- Operating Systems: Linux (64-bit)
- Tools: Flutter depends on these command-line tools being available in your environment (
- Shared libraries: Flutter test command depends on this library being available in your environment.
libGLU.so.1– provided by mesa packages such as
libglu1-mesaon Ubuntu/Debian and mesa-libGLU on Fedora.
This article explains two methods of installing Flutter on Ubuntu 20.04.
Choose the installation method that is most appropriate for your environment.
Method 1: Installing Flutter as a Snap Package
The easiest way to install Flutter on Ubuntu 20.04 is by using the snap packaging system.
The Flutter snap package is distributed and maintained by Google.
A snap package is a type of universal Linux package that you can enjoy irrespective of the distro. Its an self-contained software packages that include the binary all dependencies needed to run the application.
All you need is the snap service pre-configured, In the case of Ubuntu 20.04, it comes with snap pre-installed.
If snapd package is not already installed then you can install it by running following command.
$ sudo apt install snapd
Note: Snap packages can be installed from either the command-line or via the Ubuntu Software application.
This is actually the Snap version of the Flutter application. It can be used on any Linux distribution that has Snap support.
Open your terminal (
Ctrl+Alt+T) and type the following command to install the Flutter package.
$ sudo snap install flutter --classic
--classic option is required because the Flutter snap requires full access to the system, like a traditionally packaged application.
Note: Once the snap is installed, you can use the following command to display your Flutter SDK path.
$ flutter sdk-path
Type the following command to update the Flutter application.
$ sudo snap refresh --list
Method 2: Installing Flutter from Source
If you don’t have snapd, or can’t use it, you can install Flutter from Source.
Compiling Flutter from the source allows you to install the latest Flutter version. Follow the following steps to install Flutter using the source code method.
There are few tools and libraries required to use Flutter on Linux. Hence, before moving further type the following 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
Download the following installation bundle to get the latest stable release of the Flutter SDK.
$ wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.5.3-stable.tar.xz
For other release channels, and older builds, see the SDK releases page.
Extract the file in the desired location.
$ cd ~/development $ tar xf ~/Downloads/flutter_linux_2.5.3-stable.tar.xz
Add the flutter tool to your path.
$ export PATH="$PATH:[PATH_OF_FLUTTER_DIRECTORY]/bin"
Replace [PATH_OF_FLUTTER_DIRECTORY] in the above command with the actual path of the folder where you have extracted the Flutter.
Here is an example:
Here we have created a folder called “flutter” and under it, we have extracted the folder. Hence the command in our case will be:
$ export PATH="$PATH:`pwd`/flutter/bin"
Now, refresh your current terminal session by closing and reopening the Terminal app as well.
To check whether your Flutter folder is in your Environment path or not type the following command.
$ echo $PATH
You are now ready to run Flutter commands! Let’s verify if Flutter command-line tools are working perfectly.
To get the current version of the Flutter SDK, including its framework, engine, and tools:
$ flutter --version
To view all commands that flutter supports:
$ flutter --help --verbose
Run flutter doctor
Although we have completed the installation successfully along with the required dependencies. Still you can run the following command to see if there are any dependencies you need to install.
$ flutter doctor
How to Uninstall Flutter from Ubuntu 20.04
For some reason, If you want to uninstall Flutter application, refer following steps.
If you have installed Flutter via Snap type the following command:
$ sudo snap remove flutter
If you have installed the appication from Source then follow these steps:
Just delete the Flutter Extracted folder itself.
You can also reset your PATH variable (if you had previously set it to include flutter as well) so that when you run flutter doctor in your terminal, you will get command not found which means it’s not there anymore.
I hope that now you have a good understanding of How to install Flutter on Ubuntu 20.04 LTS Focal Fossa.
If anyone does have any questions about what we covered in this guide then feel free to ask in the comment section below and I will do my best to answer those.