how to install flutter in linux, the easy way

Let's see how to install Flutter in the most easy way possible in every debian distribution, so if you have Linux Elementary OS (Like me) or Ubuntu, Mint, Mx etc you can follow along.

Downloading the material

We have to download to main things to start, the Flutter package that you can download from here and the Android SDK from here.

Unpacking our packages

Open a terminal window where you have downloaded your videos and unpack the tar.gz files by using this command:

tar -xvf flutter-package-name.tar.xz
tar -xvf android-studio-package-name.tar.xz

After unpacking the packages let's move them into the "/opt/" folder so we have a clean installation

Creating symbolic links

To be able to run Flutter and Android SDK without the need of going every time inside the "/opt/flutter/bin" folder we have to create symbolic link, to do so we have to write:

ln -s /opt/flutter/bin/flutter /sbin/flutter
ln -s /opt/android-studio/bin/studio.sh /sbin/studio

Start Android SDK

Now we can start Android SDK by typing studio in a terminal window, then we have to go with the installation process, let's create any project so we can enter the IDE interface.

File > Settings

Now we have to into "File > Settings" the click on plugins tab and search for the flutter package, click on install and wait until in ends; After doing so we have to click into restart IDE.

Let's create a Flutter project

Now we can create a flutter project by going into "File > New > New Flutter Project..."

File > New > New Flutter Project...

Setting Flutter SDK path location

We have to set the Flutter SDK path, and we have to point on where we have installed flutter, in our case " /opt/flutter/ " and click on next and finish.

Create your virtual device

It's time to create our virtual device, so we have to go into "tools > AVD manager" select the Create Virtual Device and choose the device that we want to create; I'll go with the Pixel 2 click next and select the Operative System to download, for example the Q by clicking into the download link near the name.

Resolve /dev/kvm

/dev/kvm

If you see in the bottom right you will find " /dev/kvm device: permission denied ",  if you try to run the virtual device it will not run.

To solve the kvm problem we have to add our user to the kvm group.

IMPORTANT NOTE:  do not chown the /dev/kvm is a bad practice.

To add our user we have to open a new terminal window; Before adding the user we have to check that we find the kvm entry by typing:

grep kvm /etc/group

You will have an output like this: kvm:x:130

Now we have to add our user by typing:

sudo adduser $USER kvm

now if we check again we will se an output like this: kvm:x:130:user_added

Now you can restart your pc to make the changes effective or logout and relogin by typing:

su - $USER

Yeah, all ready

Now we have to reopen Android SDK and return on our previously create project or create a new one, click on the top into no device and we have to select our device.

After doing so we have to open up a new terminal window and type flutter doctor the last thing that we have to do is to accept the licenses by typing:

flutter doctor --android-licenses

Good job :D

Fantastic now you have everything set and working properly, try the hot reload feature by changing from blue to green in the line:

primarySwatch: Colors.blue

Now you can enjoy your flutter and have fun.

If you want a beginning guide video about Flutter here I've done one.

flutter linux easy tutorial dart