Flutter Installation
Before learning to build Flutter apps, you need to install the Flutter SDK and all required dependencies on your local machine. This section will describe in detail the installation steps on Windows, macOS, and Linux.
System Requirements
Before installing Flutter, please make sure your development environment meets the following basic requirements:
| Requirement | Windows | macOS | Linux |
|---|---|---|---|
| Operating system | Windows 10 or later | macOS 10.14 or later | Ubuntu 18.04 or later |
| Disk space | At least 2.8 GB | At least 2.8 GB | At least 2.8 GB |
| Tool | Git for Windows | Git (via Xcode) | Git、curl、unzip |
Windows Installation Steps
Step 1: Install Git for Windows
Git is a version control tool that Flutter uses to manage code and download the SDK.
- Access the Git for Windows download page
- Download the latest version of Git for Windows
- Run the installer and complete the installation with the default settings
Step 2: Install Visual Studio Code (Recommended)
Visual Studio Code (VS Code for short) is our recommended editor for Flutter development; it provides rich Flutter extension support.
- Access the VS Code official website
- Download and install VS Code
- After installation, open VS Code
Step 3: Install the Flutter SDK
There are two ways to install the Flutter SDK:
Method 1: Install using VS Code (Recommended)
The Flutter extension for VS Code can automatically download and configure the Flutter SDK.
- Click the extensions icon on the left in VS Code (or press Ctrl+Shift+X)
- Search for "Flutter" and find the "Dart and Flutter extensions" extension
- Click "Install" to install the extension
- After installation, press Ctrl+Shift+P to open the command palette
- Type "Flutter: New Project" and select it
- Select "Download SDK", then choose the installation directory
Method 2: Manual download and installation
- Access the Flutter official download page
- Download the latest Flutter SDK (.zip file)
- Extract the downloaded file to a directory of your choice, such as C:\flutter
- Add Flutter's bin directory to the system environment variable PATH
Manually configure environment variables
Steps to configure environment variables on Windows:
- Right-click "This PC" and select "Properties"
- Click "Advanced system settings"
- Click "Environment Variables"
- Find Path in "System variables" and click "Edit"
- Click "New" and add the path to Flutter's bin directory (such as C:\flutter\bin)
- Click OK to save
macOS Installation Steps
Step 1: Install Git
macOS usually comes with Git preinstalled; you can check with the following command:
$ git --version
If it is not installed, run the following command:
$ xcode-select --install
After the dialog appears, click the "Install" button.
Step 2: Install VS Code
From the VS Code official website Download and install VS Code.
Step 3: Install the Flutter SDK
Similar to Windows, you can choose to install from VS Code or install manually.
Manual installation steps:
- Download the Flutter SDK:
$ git clone https://github.com/flutter/flutter.git -b stable
- Add Flutter to PATH:
$ echo 'export PATH="$PATH:/Users/你的用户名/flutter/bin"' >> ~/.zshrc
$ source ~/.zshrc
Linux Installation Steps
Step 1: Install Required Tools
On Ubuntu/Debian systems, run the following command to install the required tools:
$ sudo apt-get update
$ sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa
Step 2: Clone the Flutter SDK
$ git clone https://github.com/flutter/flutter.git -b stable
Step 3: Configure PATH
$ echo 'export PATH="$PATH:$HOME/flutter/bin"' >> ~/.bashrc
$ source ~/.bashrc
Verify the installation
Regardless of which operating system you use to install Flutter, you can verify whether the installation was successful with the following command:
$ flutter doctor
After running this command, Flutter will check your development environment and report any issues. If the installation is successful, you will see output similar to the following:
Doctor summary (v3.x.x):
[✓] Flutter (Channel stable, 3.x.x)
[✓] Android toolchain
[✓] iOS toolchain
[✓] Chrome (for web development)
[✓] Windows toolchain
[✓] macOS toolchain
[✓] Linux toolchain
[✓] Web server
The first time you run flutter doctor, it will download the Dart SDK and perform some initialization, which may take a few minutes.
Common Problem Solutions
Flutter Command Not Found
If entering the flutter command in the terminal shows it is not found, please check:
- Whether the environment variable PATH is configured correctly
- Whether a new terminal window was opened (environment variable changes require a new window to take effect)
Android Studio Not Installed Warning
When running flutter doctor, you may see a warning that Android Studio is not installed. If you do not develop Android apps, this warning can be ignored.
Android SDK Issues
If you need to develop Android apps but encounter SDK issues, you can:
- Download and install Android Studio
- Install the Android SDK through SDK Manager in Android Studio