Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add flutter SDK to PATH permanently on ubuntu linux?

I'm very new to using linux as my primary OS. Yesterday I just did a clean install of ubuntu on my pc. I after that I started setting up my desktop. Anything necessary is being installed to run flutter but whenever I run flutter flutter: command not found. I have tried seeing similar questions on stackoverflow but I do not see specific configuration of adding flutter to PATH on ubuntu and it is kinda confusing to me since I'm not experienced with linux for now.

When I enter the following export PATH="$PATH:development/flutter/bin" command in the terminal, flutter is working but when I close that terminal in which I entered this command and boom, flutter is not being recognized in the console again.

What I want is flutter sdk to be added permanently to PATH so that I can access flutter command whenever I want in the terminal.

I'm using ubuntu -v Ubuntu 18.04.3 LTS. Thank you.

like image 734
Muje Avatar asked Feb 10 '20 07:02

Muje


2 Answers

Just edit the .bashrc file in your home directory and add

export PATH="$PATH:$HOME/[path to the directory you have installed flutter]/flutter/bin"

For example:

`export PATH="$PATH:$HOME/Documents/development/flutter/bin"`

Save the file and reopen the terminal

like image 85
Aayush24 Avatar answered Oct 21 '22 04:10

Aayush24


  1. Modify your .bashrc file (a file that configures your bash shells)

Go to your home folder and press Ctrl+H, to see hidden files. And open the .bashrc file.

Or, alternatively, put this in a terminal:

sudo gedit ~/.bashrc

2. Add a directory to your PATH variable (a global variable which tells your computer where to look for programs)

The last line of your .bashrc file should look something like this*:

export PATH="/home/tom/Flutter/flutter/bin/cache/dart-sdk/bin:${PATH}"

*If you want to add multiple new folders to your PATH variable, feel free to repeat this line as often as you'd like.

  1. Re-open a terminal

After you modify your path variable you should re-open your terminals.

like image 33
Tom O Avatar answered Oct 21 '22 06:10

Tom O