/ Flutter笔记  

【Flutter笔记】一切的开始(环境搭建)

安装

SDK下载

Fluute SDK Download

还可以在Github仓库下载

1
git clone -b master https://github.com/flutter/flutter.git

环境变量

1
export PATH=/你的flutter文件夹所在位置/flutter/bin:$PATH

例如 export PATH=/Users/Name/flutter/bin:$PATH

国内使用Flutter可镜像到Google为国内开发者搭建的站点

1
2
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

检查环境

通过一下命令检查机器缺失的依赖

1
flutter doctor

该命令会检查出系统缺失的依赖,如

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[✓] Flutter (Channel master, v1.9.8-pre.38, on Mac OS X 10.14.6 18G87, locale
zh-Hans-CN)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS
development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin
code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install:
sudo gem install cocoapods
pod setup
[!] Android Studio (version 3.4)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.37.1)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available

! Doctor found issues in 6 categories.

我们可以根据提示来一一安装它们

通过上面的提示一步步检查未安装的依赖,重新运行flutter doctor没有问题后,至此环境搭建完毕