Flutter is a UI framework having Dart as an underlying programming language. It is developed by Google with which native apps for mobile, web, and desktop can be developed with a single code base in a very short time. Flutter architecture is based on two key parts- the Flutter Engine and the Flutter Framework.
The engine contains all core technologies such as the Skia 2D rendering engine ( https://skia.org ), which is also developed by Google and is used in Chrome or Firefox, for example.
In addition, the Dart Runtime, which, among other things, takes over garbage collection or provides an extremely fast hot reload during development.
Flutter installation on Fedora Linux
Here we are using Fedora 34 to install the Flutter UI framework, however, the steps will be the same for Fedora 33/32/31/30/29.
Requirments
- 64-bit Linux system
- 600 MB free Space at least
We have tried to make the below steps as simple as possible so that a beginner can easily install and start coding using Flutter.
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 Fedora. In addition to refreshing the system repo cache.
sudo dnf update
2. Install Dependencies
There are few tools and libraries required to use Flutter on Linux such as Fedora. Hence, before moving further use the below-given command to install them.
sudo dnf install bash curl file git unzip which xz zip mesa-libGLU 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- mycoding you can use whatever you want.
mkdir mycoding
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. Extract Tarball file & Install Flutter on Fedora
Switch to the folder where you want to extract the downloaded flutter files. For example, here we have created a dedicated directory called- mycoding and we are using that.
cd mycoding
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 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
gedit ~/.bashrc
Here is the syntax to use:
export PATH="$PATH:[path-to-flutter-directory]/bin"
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 mycoding
and under it, we have extracted the folder. Hence the above command in our case will be:
gedit ~/.bashrc
At the end of the file add the PATH in the following format:
export PATH="$PATH:~/mycoding/flutter/bin"
Refresh Terminal session
Now, refresh your current terminal session using the given command. Alternatively, we can close and reopen the Terminal app as well.
source ~/.bashrc
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 Environment path, let’s verify Flutter command-line tools are working perfectly.
which flutter
To check dart location:
which flutter dart
To check the version:
flutter --version
Output:
Flutter 2.5.0 • channel stable • https://github.com/flutter/flutter.git Framework • revision 4cc385b4b8 (4 days ago) • 2021-09-07 23:01:49 -0700 Engine • revision f0826da7ef Tools • Dart 2.14.0
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:
flutter doctor
In the below-given screenshot, you can see that we have two missing things we require for the full setup that is the Android toolchain and Android Studio. Let’s install them in the next step.
7. Install Android Studio
First, install some required libraries:
sudo dnf install zlib.i686 ncurses-libs.i686 bzip2-libs.i686
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.
cd Downloads
Extract file:
tar xvf android-studio-*-linux.tar.gz
Move extracted file to /opt directory.
sudo mv android-studio /opt/
Run Android Studio:
/opt/android-studio/bin/./studio.sh
Next, simply follow the Wizard.
(optional) In case you want to create Android Studio Linux Desktop Shortcut and Command follow the link
8. 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.
9. Add command-line tools to your environment
Edit Bash profile
gedit ~/.bashrc
At the end of the file add the following line
export PATH=$PATH:~/Android/Sdk/cmdline-tools/latest/bin
Save the file and reload the bash.
source ~/.bashrc
10. 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.
flutter doctor
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 Fedora Linux. Know more about it from the official documentation.
In Fedora 35 the libgtk-3-devel doesn’t exist. The required package is probably gtk3-devel.
Good walk through. I can confirm UncleFoo’s comment. On Fedora go try gtk3-devel if flutter doctor barks.