1.环境搭建
1.下载sdk
使用git克隆Flutter,命令:gitclone -b beta https://github.com/flutter/flutter.git;
从官网下载flutter,https://flutter.io/setup-macos/;
2.配置环境
vim .bash_profile
#flutter
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/dawn/Flutter/flutter/bin:$PATH
source .bash_profile
3.检测结果
flutter doctor
提示结果
Downloading Dart SDK from Flutter engine 4737fc5cd89b8f0136e927b00f2e159444b95a73...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 118M 100 118M 0 0 2457k 0 0:00:49 0:00:49 --:--:-- 2446k
Building flutter tool...
╔════════════════════════════════════════════════════════════════════════════╗
║ Welcome to Flutter! - https://flutter.io ║
║ ║
║ The Flutter tool anonymously reports feature usage statistics and crash ║
║ reports to Google in order to help Google contribute improvements to ║
║ Flutter over time. ║
║ ║
║ Read about data we send with crash reports: ║
║ https://github.com/flutter/flutter/wiki/Flutter-CLI-crash-reporting ║
║ ║
║ See Google's privacy policy: ║
║ https://www.google.com/intl/en/policies/privacy/ ║
║ ║
║ Use "flutter config --no-analytics" to disable analytics and crash ║
║ reporting. ║
╚════════════════════════════════════════════════════════════════════════════╝
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure
you trust this source!
Downloading Material fonts... 1.4s
Downloading android-arm-profile/darwin-x64 tools... 1.1s
2.提示出错
按照检测结果的说明,如果有[!] ✗ 标志,表示本行检测不通过,需要做一些设置或者安装一些软件
[!] Android Studio (version 3.2)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.33.1)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
! Doctor found issues in 5 categories.
需要运行
flutter doctor --android-licenses
Warning: File /Users/dawn/.android/repositories.cfg could not be loaded.
4 of 6 SDK package licenses not accepted. 100% Computing updates...
Review licenses that have not been accepted (y/N)? y
对于需要判断的输入y就行了,之后会出现一下提示
Accept? (y/N): y
All SDK package licenses accepted
2.Android studio 运行demo
1.在Android studio的 perferences 中选中plugins,之后会出现一个弹出框
输入flutter 之后点击安装
2.