Other guides can also be referenced here: How to upgrade from Ubuntu 20.04 LTS to 22.04 LTS and how to install Golang on a Linux System, how to upgrade from Ubuntu 20.04 LTS to 22.04 LTS, how To Install Google Cloud SDK on a Linux System and Weather from the Terminal: How to check whether details from the Command Line in Windows, macOS, Linux, and your Web browser.
Prerequisites to set up Flutter with Android Studio
- A system running Ubuntu 20.04 or higher
- A user account with admin privileges
- Access to the command line/terminal
Setting Up Flutter With Android Studio
Flutter may be set up in a variety of methods, but in this case, we’ll utilize snap packages and Android Studio to do it. as it would take a lot of time to use their tar files from their official websites.
Utilizing snap packages speeds up the process and reduces the likelihood of running into issues. Please here are some interesting guides also: How to install Microsoft Teams on a Mac PC , how to Get, Edit, Create and Delete Registry Keys in PowerShell and How to use Systemd Timers on Linux.
Step 1: Install Flutter on your Linux machine
Install the snap package for Flutter by first opening the terminal and entering the command shown below:
sudo snap install flutter --classic
Run the command listed below to confirm that all necessary packages are installed before concluding the installation of flutter.
Once your Flutter is ready and all necessary packages are installed, you will get the “Welcome to Flutter!” message below. All you now require is the Android SDK.
Step2: Install and configure Android Studio
Installing Android Studio will allow us to use the Android SDK and let it do all of the work. Open your terminal and enter the command below to install Android Studio:
sudo snap install android-studio --classic
After completing the installation of Android Studio, launch it by entering the command below:
When your Android Studio launches, it will resemble the following:
As soon as your Android Studio launches, it Once Android Studio has launched, you will need to confirm a few options. Unless your Android Studio begins installing the Android SDKs and other required components, leave the default settings in place and keep pressing Next.
Next make sure you download all the required components
You must see that is completed just as shown below
Step3: Set up Flutter and Accept Android licenses
Go to your terminal and enter the following command after the installation of Android Studio is complete:
flutter config --android-studio-dir /snap/android-studio/current/android-studio
Your Android Studio directory will be configured to point to the Android Studio snap package directory you just downloaded. Run the subsequent command to open the licenses for Android now. As long as you have to, keep typing “y” to accept the licenses.
flutter doctor --android-licenses
Step 4: Verify the Flutter set up
Run a Flutter sample app
After installing Flutter on our Laptop, let’s test it out with an example app to make sure everything is functioning as it should.
Step 1: Create a directory and CD into it
First, use the mkdir and cd commands to create a directory instead, with whatever name you choose, and then cd into it:
mkdir sample_app cd sample_app
Step 2: Initialize the directory with Flutter starter files
Once within the directory, execute the following command:
flutter create .
Step 3: Run the Flutter hello-world app
Run the following command to launch your Flutter app when flutter create has finished running:
Wait a bit, and then open a Chrome tab with a running program, and you should see the panels below in your Terminal and Chrome, respectively.
In this tutorial, we spoke about how to set up Flutter on a Linux machine in a simple manner that even a novice could handle. To make sure Flutter functions flawlessly, we also saw the process of launching an app.