How to enable Flutter Desktop support in Ubuntu Linux

How to setup Flutter Desktop development environment on Ubuntu


Flutter can be used to create Linux applications, which is possible by enabling the feature. Before that I would like recommend the basic flutter setup on Ubuntu post.

How to install Flutter on Ubuntu Linux

Lets Install Flutter for Ubuntu Linux development. As a open source project, we can install the flutter SDK from GitHub.

The prerequisites

In order to clone the repository we have to use git . In case your SUSE doesn’t know what it is, let’s install it with snap . Also recommend to have Visual Code /Atom for editing the code.

The following post may help you to install VS Code on Ubuntu

Install the git

sudo snap install git

Clone the repo

Get the latest stable version from GitHub repository or alternatively can download from flutter site

git clone https://github.com/flutter/flutter.git -b stable --depth 1

Use the -b option to clone the stable version

Setup the path variable

You also need to set the path variable using the shell command as follows.

</p>
export PATH="$PATH:pwd/flutter/bin"
<p>

Call the Doctor

run Flutter doctor command to inspect status of your Flutter SDK

Flutter Doctor

Android IOS development

For Android you have to install the Android Studio for development tool support which can be download from official website.

For official documentation visit flutter.dev

Enable desktop feature

In order to make Linux ready for Flutter desktop development environment we should have following dependencies

  • clang
  • cmake
  • ninja- build
  • pkg-config
  • libgtk-3-dev
  • libblkid-dev
  • liblzma-dev

install them using snap/ apt-get command

sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev

Now switch to the dev channel and run upgrade command, which will install necessary libraries and packages.

flutter channel dev
flutter upgrade

Configure the feature using config

flutter config --enable-linux-desktop

run the flutter doctor and then flutter devices as follows

flutter doctor
flutter devices

Make sure the devices command list the Linux desktop

Test Run

Create sample Flutter project

flutter create myweb_app

run the app using flutter run command

Flutter Desktop app in openSUSE
flutter run -d linux
or
flutter run

Happy fluttering

Author: Manoj

Developer and a self-learner, love to work with Reactjs, Angular, Node, Python and C#.Net

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.