Learn how to install the Flutter SDK on Windows, macOS, and Linux. Follow step-by-step instructions to set up your development environment and start building cross-platform apps.
Embarking on your Flutter journey begins with setting up the Flutter SDK, a crucial step that lays the foundation for your app development endeavors. This section provides a detailed guide on downloading and installing the Flutter SDK across different operating systems, ensuring you have a seamless start.
Before diving into the installation process, it’s essential to download the Flutter SDK. The Flutter team provides different channels for releases: stable, beta, and dev. For beginners, we recommend starting with the stable release to ensure a more reliable and tested experience.
The stable channel is the most reliable and is recommended for production apps, while the beta channel includes the latest features but may have some instability.
The installation process varies slightly depending on your operating system. Below, we provide step-by-step instructions for Windows, macOS, and Linux.
Download the Flutter SDK: Visit the Flutter SDK download page and download the latest stable release for Windows.
Extract the ZIP File: Once downloaded, extract the contents of the ZIP file to a desired location on your system. A common practice is to place it in C:\src\flutter
.
Update the PATH Environment Variable:
Path
variable and select it. Click Edit.flutter\bin
directory (e.g., C:\src\flutter\bin
).Verify Installation: Open a new Command Prompt window and run the following command to verify the installation:
flutter --version
This command should display the installed version of Flutter.
Download the Flutter SDK: Navigate to the Flutter SDK download page and download the latest stable release for macOS.
Extract the ZIP File: Open the downloaded ZIP file and move the flutter
folder to a suitable location, such as /Users/YourName/Development/flutter
.
Update PATH in .bash_profile or .zshrc:
Open Terminal and run the following command to open your profile file in a text editor:
nano ~/.bash_profile
Or, if you are using Zsh:
nano ~/.zshrc
Add the following line to the end of the file:
export PATH="$PATH:/Users/YourName/Development/flutter/bin"
Save the file and refresh your Terminal session by running:
source ~/.bash_profile
Or for Zsh:
source ~/.zshrc
Verify Installation: Run the following command in Terminal to verify the installation:
flutter --version
You should see the installed version of Flutter.
Download the Flutter SDK: Visit the Flutter SDK download page and download the latest stable release for Linux.
Extract the TAR File: Extract the contents of the TAR file and place the flutter
directory in your home directory or another suitable location.
Update PATH in .bashrc or .bash_profile:
Open a Terminal window and use a text editor to open your .bashrc
or .bash_profile
file:
nano ~/.bashrc
Add the following line to the end of the file:
export PATH="$PATH:$HOME/flutter/bin"
Save the file and refresh your Terminal session by running:
source ~/.bashrc
Verify Installation: Run the following command in Terminal to verify the installation:
flutter --version
This command should display the installed version of Flutter.
Once the Flutter SDK is installed, the next step is to run flutter doctor
. This command checks your environment and displays a report of the status of your Flutter installation. It identifies any missing dependencies or issues that need to be addressed.
Open a terminal or command prompt and run:
flutter doctor
This command will output a list of checks that Flutter performs on your environment. Here’s a sample output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.61.2)
[✓] Connected device (1 available)
• No issues found!
For any issues reported by flutter doctor
, follow the provided instructions or consult the official Flutter documentation for troubleshooting tips.
Even with a straightforward installation process, you might encounter some common issues. Here are some troubleshooting tips to help you resolve them:
flutter
, ensure that the Flutter SDK path is correctly added to your system’s PATH environment variable.sudo
to modify certain files or directories. Be cautious with permissions to avoid security issues.flutter doctor
to identify and install any missing dependencies, such as the Android SDK or Xcode.For more detailed troubleshooting, refer to the official Flutter troubleshooting guide.
flutter upgrade
.Now that you have installed Flutter, let’s create a simple “Hello World” app to ensure everything is working correctly.
Create a New Flutter Project:
Open a terminal and navigate to your desired project directory.
Run the following command to create a new Flutter project:
flutter create hello_world
Navigate to the Project Directory:
cd hello_world
Run the App:
Connect a device or start an emulator.
Run the following command to launch the app:
flutter run
You should see a simple Flutter app running on your device or emulator. Congratulations on setting up your Flutter development environment!
By following this comprehensive guide, you are now equipped to install and configure the Flutter SDK on your system, paving the way for your journey into cross-platform app development. Happy coding!