Install and configure the Flutter development environment on the Windows operating system
table of Contents
-
-
-
-
-
- System configuration requirements
- Get the Flutter SDK
- path environment variable
- Run flutter doctor
- Install Android Studio
- Configure Android device
- Configure Android emulator
- Web platform settings
- Install VS Code
- Install Flutter and Dart plugins
- Verify that the installation is successful through the Flutter Doctor command
- Install Emacs editor
-
-
-
-
System configuration requirements
- Operating system: Windows 7 SP1 or higher (64-bit operating system based on x86-64)
- Disk space: In addition to installing IDE and some tools, there should be at least 1.64 GB of space
- Tools: To make Flutter work normally in your development environment, rely on the following tools:
Windows PowerShell 5.0 or higher (pre-installed in Windows 10)
Git for Windows 2.x , and check the command from Windows The prompt uses Git options.
If the Windows version of Git has been installed, please make sure you can execute the git command directly from the command prompt or PowerShell
Get the Flutter SDK
1. Click the installation package below to get the latest version of the Flutter SDK for the stable distribution channel:
flutter_windows_2.0.2-stable.zip
To view other distribution channels and previous versions, please refer to the SDK version list page.
2. unpack the archive, which then the flutter
entire directory path you want to put in place Flutter SDK (e.g. C:\src\flutter
).
Note
Do not Flutter installed in the folder that require high privileges, such as C:\Program Files\
if you do not want to install the specified version of the installation package. You can ignore steps 1 and 2. Get the source code from the Flutter repo on GitHub , and switch to the designated branch or tag as needed. E.g:
C:\src>git clone https://github.com/flutter/flutter.git -b stable
Now you can use Flutter commands in the console
path environment variable
New in system variables:
PUB_HOSTED_URL : https://pub.flutter-io.cn
New:
FLUTTER_STORAGE_BASE_URL: https://storage.flutter-io.cn
Added to the PATH variable: to the flutter/bin
path
Run flutter doctor
Execute in CMDflutter doctor
Shown above you can see the contents of the display Android Studio未安装
; 找不到Android SDK
; 找不到chrome
;
Install Android Studio
1. Download and install Android Studio , Android Studio domestic mirror
2. Run Android Studio and enter'Android Studio Setup Wizard', which will install the latest Android SDK, Android SDK Platform-Tools and Android SDK Build-Tools, these are all What you need when developing Android Flutter applications
Configure Android device
Before running or testing the Flutter application on an Android device, you need a device running Android 4.1 (API version 16) or higher.
1. Open the Developer options and USB debugging options on the device. You can check the Android documentation for more details Method introduction.
2. If you are using it on the Windows platform, you need to install Google USB Driver
. 3. Connect the phone and the computer through the USB interface. If an authorization pop-up window pops up on the device, allow the authorization so that the computer can access your development device.
4. In the command line, using the flutter devices
command to ensure Flutter device you can recognize that the connected Android.
By default, Flutter uses the current version of the adb
Android SDK version of the tool depends, if you want to use another Flutter Android SDK, you can set up ANDROID_HOME
to achieve this objective environment variable
Configure Android emulator
Follow the steps below to run or test the Flutter application on your Android emulator:
1. Activate the VM acceleration option on the machine .
2. Open Android Studio, click the AVD Manager button, select Create Virtual Device...
- In some old Android Studio versions, you need to go to Android Studio> Tools> Android> AVD Manager, and then select the Create Virtual Device option. (The Android sub-option will only be displayed in the Android project.)
- If you have not opened a project, you can choose Configure> AVD Manager and then select the Create Virtual Device option
. 3. Select the corresponding device and select the Next option.
4. Select one or more system images of the Android version you want to simulate, and then select the Next option. It is recommended to choose x86 or x86_64 mirroring.
5. Select Hardware in Emulated Performance - GLES 2.0 option to turn on hardware acceleration .
6. Make sure that the AVD options are configured correctly, and select the Finish option.
For more detailed information on the above steps, please check the Managing AVDs page.
7. In the Android Virtual Device Manager, click the Run option in the toolbar, the emulator will start and display the corresponding interface for the system version and device you selected.
Web platform settings
Flutter is now in the stable
channel support to build Web applications. Use Flutter 2 application will automatically build support Web channels, if you need to add to an existing Web application support, read the document using the Flutter building Web applications
Install VS Code
VS Code is a lightweight editor that can run and debug Flutter.
- VS Code , the latest stable version
Install Flutter and Dart plugins
1. Open VS Code
2. Open View> Command Panel...
3. Type "install", and then select Extension: Install the extension.
4. Enter "flutter" in the extended search input box, then select Flutter in the list and click Install. The necessary Dart plugins will be installed automatically during this process
5. Click Reload to restart VS Code
Verify that the installation is successful through the Flutter Doctor command
1. Open View> Command Panel...
2. Type "doctor" and select Flutter: Run Flutter Doctor
3. Open the OUTPUT panel to check if there is an error, and make sure to select the drop-down list of different output options (Output Options) Flutter
Install Emacs editor
Emacs is a lightweight editor that supports the
latest version of Emacs editor of Flutter and Dart .
Installing the lsp-dart package For
how to install and use the lsp-dart package, you can check the lsp-dart document