Search code examples
bashubuntuflutterterminalpath

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.


Solution

  • 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