Streamit Laravel - Documentation
Streamit Laravel

How to setup Flutter environment

πŸͺŸSetup Flutter Environment for Your System

To install and set up Flutter, follow the steps below based on your operating system (Windows, macOS, Linux).

Step 1: Install Flutter SDK

  1. Download the Flutter SDK based on your operating system.
  2. Extract the downloaded ZIP file.

πŸ’‘ TIP: To manage multiple Flutter versions easily, follow these steps:

  • Create a folder named flutter_sdk
  • Extract the ZIP into the flutter_sdk folder
  • Rename the extracted folder to something like flutter_3_27_0
  • Copy the path to the bin directory (Right-click on bin > Properties or Info to get full path)

Step 2: Add SDK Path to Your Environment

For Windows:

  1. Open Start Menu β†’ Search β€œEdit Environment variables for your account”.
  2. Find the Path variable β†’ Click β€œEdit” (or create a new one named Path).
  3. Paste the path to your Flutter bin directory.
  4. Click β€œOK” on all windows to save changes.
  5. Open Command Prompt and run:
flutter doctor

This verifies if Flutter is now accessible globally.

For macOS/Linux:

1. Open Terminal: Launch the Terminal application on your macOS or Linux system.

2. Navigate to Home Directory: You can navigate to your home directory by typing β€œcd ~” and pressing Enter.

3. 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)

4. 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_27_0, the line would look like this:

export PATH=”$PATH:$HOME/flutter_sdk/flutter_3_27_0/bin”

5. 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.

6. Apply Changes: To apply the changes to the current Terminal session, run:

source ~/.bashrc  # For Bash
source ~/.zshrc   # For Z shell (zsh)

7. Open a new terminal and run:

flutter doctor

This checks whether Flutter is working globally on your system.