獲取 Flutter SDK
- 使用
git去克隆倉庫 - 添加
flutter工具到環(huán)境變量 - 運(yùn)行
flutter doctor來顯示剩下你需要安裝的的依賴。
克隆倉庫
如果這是你第一次在電腦上安裝 Flutter ,需要克隆這個(gè)遠(yuǎn)程倉庫:
$ git clone -b beta https://github.com/flutter/flutter.git
D:\>git clone -b beta https://github.com/flutter/flutter.git
Cloning into 'flutter'...
remote: Counting objects: 128732, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 128732 (delta 0), reused 0 (delta 0), pack-reused 128729
Receiving objects: 100% (128732/128732), 40.15 MiB | 500.00 KiB/s, done.
Resolving deltas: 100% (96845/96845), done.
Checking out files: 100% (2543/2543), done.
要更新現(xiàn)有版本的 Flutter ,參閱 升級(jí) Flutter
更新你的環(huán)境變量
- 打開 “控制面板 > 系統(tǒng)和安全 > 系統(tǒng) > 高級(jí)系統(tǒng)設(shè)置 > 環(huán)境變量”。
- 在 Path 變量末尾添加
;并且加上flutter\bin的全路徑。
運(yùn)行 flutter doctor
打開一個(gè)新的命令提示符運(yùn)行以下的命令,看是否需要安裝依賴項(xiàng)來完成安裝:
$ flutter doctor
你可能會(huì)遇到下載不下來的情況,只需添加如下兩對(duì)鍵值到環(huán)境變量中再次運(yùn)行即可:

image.png
FLUTTER_STORAGE_BASE_URL
https://storage.flutter-io.cn

image.png
PUB_HOSTED_URL
https://pub.flutter-io.cn
PUB_HOSTED_URL和FLUTTER_STORAGE_BASE_URL是谷歌的國內(nèi)臨時(shí)鏡像。
接下來運(yùn)行flutter doctor
D:\>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.5.1, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.1)
[√] Connected devices (1 available)
? No issues found!
環(huán)境OK,輸入flutter devices查看電腦已連接的設(shè)備:
D:\>flutter devices
1 connected device:
ONEPLUS A3010 ? c402b0b1 ? android-arm64 ? Android 7.1.1 (API 25)
創(chuàng)建APP:
flutter create myapp
E:\Work>flutter create myapp
Creating project myapp...
myapp\.gitignore (created)
myapp\.idea\libraries\Dart_SDK.xml (created)
myapp\.idea\libraries\Flutter_for_Android.xml (created)
myapp\.idea\modules.xml (created)
myapp\.idea\runConfigurations\main_dart.xml (created)
myapp\.idea\workspace.xml (created)
myapp\.metadata (created)
myapp\android\app\build.gradle (created)
myapp\android\app\src\main\java\com\example\myapp\MainActivity.java (created)
myapp\android\build.gradle (created)
myapp\android\.gitignore (created)
myapp\android\app\src\main\AndroidManifest.xml (created)
myapp\android\app\src\main\res\drawable\launch_background.xml (created)
myapp\android\app\src\main\res\mipmap-hdpi\ic_launcher.png (created)
myapp\android\app\src\main\res\mipmap-mdpi\ic_launcher.png (created)
myapp\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png (created)
myapp\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png (created)
myapp\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png (created)
myapp\android\app\src\main\res\values\styles.xml (created)
myapp\android\gradle\wrapper\gradle-wrapper.properties (created)
myapp\android\gradle.properties (created)
myapp\android\settings.gradle (created)
myapp\ios\Runner\AppDelegate.h (created)
myapp\ios\Runner\AppDelegate.m (created)
myapp\ios\Runner\main.m (created)
myapp\ios\Runner.xcodeproj\project.pbxproj (created)
myapp\ios\.gitignore (created)
myapp\ios\Flutter\AppFrameworkInfo.plist (created)
myapp\ios\Flutter\Debug.xcconfig (created)
myapp\ios\Flutter\Release.xcconfig (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Contents.json (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-1024x1024@1x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@1x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@2x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@3x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-29x29@1x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-29x29@2x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-29x29@3x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@1x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@2x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@3x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-60x60@2x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-60x60@3x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-76x76@1x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-76x76@2x.png (created)
myapp\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-83.5x83.5@2x.png (created)
myapp\ios\Runner\Assets.xcassets\LaunchImage.imageset\Contents.json (created)
myapp\ios\Runner\Assets.xcassets\LaunchImage.imageset\LaunchImage.png (created)
myapp\ios\Runner\Assets.xcassets\LaunchImage.imageset\LaunchImage@2x.png (created)
myapp\ios\Runner\Assets.xcassets\LaunchImage.imageset\LaunchImage@3x.png (created)
myapp\ios\Runner\Assets.xcassets\LaunchImage.imageset\README.md (created)
myapp\ios\Runner\Base.lproj\LaunchScreen.storyboard (created)
myapp\ios\Runner\Base.lproj\Main.storyboard (created)
myapp\ios\Runner\Info.plist (created)
myapp\ios\Runner.xcodeproj\project.xcworkspace\contents.xcworkspacedata (created)
myapp\ios\Runner.xcodeproj\xcshareddata\xcschemes\Runner.xcscheme (created)
myapp\ios\Runner.xcworkspace\contents.xcworkspacedata (created)
myapp\lib\main.dart (created)
myapp\myapp.iml (created)
myapp\myapp_android.iml (created)
myapp\pubspec.yaml (created)
myapp\README.md (created)
myapp\test\widget_test.dart (created)
Wrote 65 files.
Running "flutter packages get" in myapp...
[√] Flutter is fully installed. (Channel beta, v0.5.1, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
[√] Android toolchain - develop for Android devices is fully installed. (Android SDK 27.0.3)
[√] Android Studio is fully installed. (version 3.1)
[√] Connected devices is fully installed. (1 available)
All done! In order to run your application, type:
$ cd myapp
$ flutter run
Your main program file is lib/main.dart in the myapp directory.