Flutter圈子Flutter中文社区

Flutter入门(一) 环境安装,编写Hello World,

2018-12-17  本文已影响6人  FanChason

相关网站

Flutter中文网
Flutter官网

环境安装

 export PUB_HOSTED_URL=https://pub.flutter-io.cn
 export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
 git clone -b dev https://github.com/flutter/flutter.git
 export PATH="$PWD/flutter/bin:$PATH"
 cd ./flutter
 flutter doctor
[✓] Android Studio (version 3.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.

解决参考:https://github.com/flutter/flutter/issues/11940

removing the old tools ($ rm -rf /Library/Developer/CommandLineTools)
install xcode command line tools again ($ xcode-select --install).

解决参考:https://stackoverflow.com/questions/34617452/how-to-update-xcode-from-command-line

创建 Hello World 应用

命令行

flutter create myapp
cd myapp
flutter devices // 获取可以运行的设备列表
flutter run -d "iPhone X" // 在其中一台设备iPhone X模拟器上运行
Snip20181217_35.png

体验热重载(hot reload)

flutter hot reload.gif

参考:

环境安装:https://flutter.io/community/china

上一篇下一篇

猜你喜欢

热点阅读