Flutter Installation
Before learning to build Flutter applications, you need to install the Flutter SDK and all required dependencies on your local machine. This section will detail the installation steps on Windows, macOS, and Linux systems.
System requirements
Before installing Flutter, ensure your development environment meets the following basic requirements:
| Requirements | 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 |
| Tools | Git for Windows | Git (via Xcode) | Git、curl、unzip |
Windows Installation Steps
Step 1: Install Git for Windows
Git is a version control tool, and Flutter needs it to manage code and download the SDK.
- VisitGit for Windows download page
- Download the latest version of Git for Windows
- Run the installer and complete the installation using the default settings
Step 2: Install Visual Studio Code (Recommended)
Visual Studio Code (VS Code) is our recommended editor for Flutter development, offering rich Flutter extension support.
- VisitVS Code official website
- Download and install VS Code
- After installation, open VS Code.
Step 3: Install 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.
- In VS Code, click the Extensions icon on the left (or press Ctrl+Shift+X)
- Search "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
- Select "Download SDK", then choose the installation directory
Method 2: Manually download and install
- VisitFlutter official website download page
- Download the latest Flutter SDK (.zip file)
- Extract the downloaded file to a directory of your choice, e.g., C:\flutter
- Add the Flutter 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"
- In "System Variables", find Path and click "Edit".
- Click "New" and add the Flutter bin directory path (e.g., C:\flutter\bin)
- Click OK to save
macOS Installation Steps
Step 1: Install Git
macOS usually comes with Git pre-installed. You can check with the following command:
$ git --version
If not installed, run the following command:
$ xcode-select --install
After the dialog box appears, click the "Install" button.
Step 2: Install VS Code
fromVS Code official websiteDownload and install VS Code.
Step 3: Install Flutter SDK
Similar to Windows, you can choose to install from VS Code or manually.
Manual installation steps:
- Download 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 necessary tools
On Ubuntu/Debian systems, run the following command to install the necessary 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 Installation
Regardless of which operating system you use to install Flutter, you can verify the installation with the following command:
$ flutter doctor
After running this command, Flutter will check your development environment and report any issues. If the installation succeeds, 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
On the first run of flutter doctor, it will download the Dart SDK and perform some initialization operations, which may take a few minutes.
Troubleshooting common issues
Flutter command not found
If the flutter command is not found in the terminal, check:
- Whether the PATH environment variable is correctly configured.
- 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, a warning may appear indicating that Android Studio is not installed. If you are not developing Android apps, you can ignore this warning.
Android SDK issues
If you need to develop Android apps but encounter SDK issues, you can:
- Download and installAndroid Studio
- In Android Studio, install the Android SDK via SDK Manager