Home Development Tools Getting Started with Flutter on Linux Desktop

Getting Started with Flutter on Linux Desktop

Software development is moving to better milestones thanks to Google’s effort in creating open-source UI software applications like Flutter. Flutter’s footprints are applicable in the development of numerous cross-platform applications by referencing a single codebase.

So whether your apps target Windows, Linux, Mac, iOS, and Android users or those used to web platforms, Flutter will natively compile and build the perfect app for your target audience.

Flutter Attributes

The Flutter open-source Google-based framework is gaining prominence as a result of the following factors.

  • Fast – In terms of performance, Flutter is unlikely to lag on any device since the Flutter code comfortably compiles JavaScript code as well as Intel/ARM machine code.
  • Productive – Most UI app development environments tend to lose their current state when a developer updates to code. With Flutter, code updates lead to instant viewable changes. Through Hot Reload, app creation and iteration processes are fastened.
  • Flexible – There is no limit to the number of customizable and adaptive app designs you can implement on your project. These app design outcomes tend to create positive user experiences on any device screen. Flutter gives the app developer ultimate control over every pixel.
  • User Outreach and Workflow Transformation – This single codebase app development and deployment approach that caters to embedded, desktop, web, and mobile devices meet the UI needs of users’ screens regardless of the screen model, size, or design. Also, the Flutter codebase is controllable through developer tooling and automated testing.

Installing Flutter on Linux

The Flutter framework can be installed on your Linux distribution via the Flutter Snap package. Ensure you are a root user or have Sudoer privileges on the system you are using before resuming the installation and configuration steps manifested on this article guide.

$ sudo snap install flutter --classic

The above command will be responsible for the installation of flutter, flutter.dart, and flutter.openurl.

Install Flutter in Linux
Install Flutter in Linux

To use dart, we need to type in flutter.dart. To reduce this long typing, also linked with the cognitive load when translating targeted instructions, we will map flutter.dart to dart to ignore the need for the prefix “flutter”.

$ sudo snap alias flutter.dart dart

Next, confirm Flutter’s installed version on your system.

$ flutter --version

This version check command can also initiate some automatic Flutter configuration on your system.

Check Flutter Version
Check Flutter Version

To check if your Flutter installation meets all the dependency requirements to run on your system, execute the following command:

$ flutter doctor 
Check Flutter Installation Requirements
Check Flutter Installation Requirements

As per the above screen capture, we have two issues related to the Android toolchain and Android Studio.

To install Android Studio, execute the following command.

$ sudo snap install android-studio --classic

The next step is to install and configure android-studio.

$ android-studio 

The primary reason for its installation and configuration is for the Android SDK and emulators maintenance.

Configure Android Studio
Configure Android Studio

Follow the installation wizard until your android-studio setup is complete.

Running Android Studio in Linux
Running Android Studio in Linux

Now point Flutter to your Android Studio snap location. Without this step, building any app; android or not android-based will be impossible.

$ flutter config --android-studio-dir /snap/android-studio/current/android-studio
Configure Flutter to Use Android Studio
Configure Flutter to Use Android Studio

On your Android Studio, reference the following screen captures to install an Android SDK command-line tool by going to ToolsSDK ManagerSDK Tools.

Install Android SDK in Linux
Install Android SDK in Linux
Installing Android SDK
Installing Android SDK

Run flutter doctor again to check any other missed dependency issues.

$ flutter doctor
Check Flutter Installation Requirements
Check Flutter Installation Requirements

To resolve this issue and use Flutter, accept Android licenses.

$ flutter doctor --android-licenses
Accept Android Lincenses
Accept Android Lincenses

Run flutter doctor again to confirm all Flutter issues are resolved.

$ flutter doctor
No Flutter Issues Found
No Flutter Issues Found

Testing Flutter in Linux

Create a project directory and navigate to it:

$ sudo mkdir linuxshelltips_flutter
$ cd linuxshelltips_flutter

Create a sample app structure:

$ flutter create newapp
Create Flutter App Project
Create Flutter App Project

To test this app, execute:

$ cd newapp
$ flutter run 
Test Flutter App
Test Flutter App
Check Flutter Demo Page
Check Flutter Demo Page

This tutorial guide has taken us through installing, configuring, and testing Flutter for your first UI app project. More on flutter project samples and tutorials can be found on its official site.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.