Setup Flutter Environment for your system
Install Flutter SDK
- Install Flutter SDK depending on your OS.
- Extract the Zip.
To Keep Flutter SDK easily manageable we recommend few tips for Storing sdk.
- Create flutter_sdk folder.
- Extract the zip into the "flutter_sdk" directory.
- Rename the extracted directory with relevant flutter_version (i.e If you have installed flutter 3.22.0 than rename the directory as "flutter_3_22_0")
- Copy the Flutter path to the bin directory. (i.e - Right Click on bin directory and open properties/info, you can see the full path to Flutter "bin" directory)
Add SDK Path to your Environment
Windows
- Open Search bar and Search for "Edit Environment variables for your account".
- If "Path" variable exist in you environment variable than click on "Edit" else click on "New" and name the variable "Path"
- paste the Path to the Flutter bin directory into "Path" variable.
- Click "OK" on all windows to save the changes.
- Open a new command prompt window and run
flutter doctor
to verify that Flutter is now accessible from anywhere.
macOS and Linux
Open Terminal: Launch the Terminal application on your macOS or Linux system.
Navigate to Home Directory: You can navigate to your home directory by typing "
cd ~
" and pressing Enter.Open or Create the Configuration File: Use a text editor like "Nano" or "Vim" to open or create the .bashrc or .zshrc file. For example:
nano ~/.bashrc # For Bash
nano ~/.zshrc # For Z shell (zsh)
- Add Flutter to PATH: Add the following line at the end of the file, replacing [PATH_TO_FLUTTER_BIN] with the actual path to the Flutter bin directory:
export PATH="$PATH:[PATH_TO_FLUTTER_BIN]"
For example, if Flutter is located in your home directory under a folder named flutter_3_22_0, the line would look like this:
export PATH="$PATH:$HOME/flutter_sdk/flutter_3_22_0/bin"
Save Changes: Save the changes you made to the file. In Nano, you can do this by pressing Ctrl + X, then Y to confirm, and finally Enter to save.
Apply Changes: To apply the changes to the current Terminal session, run:
source ~/.bashrc # For Bash
source ~/.zshrc # For Z shell (zsh)
Verify Flutter Installation: Open a new Terminal window or tab, and run flutter doctor
to verify that Flutter is now accessible from anywhere.