美文网首页Flutter圈子Flutter中文社区
Flutter入门(一) 环境安装,编写Hello World,

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

作者: FanChason | 来源:发表于2018-12-17 16:25 被阅读6次

    相关网站

    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
    
    • 执行flutter doctor,未完成的环境安装按照提示安装就好。
      下面问题记录下:
      • Android Studio缺少Flutter和Dart plugin
    [✓] 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

    • xcode-select 需要升级
    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

    • 安装好了是这样:


      Snip20181217_28.png

    创建 Hello World 应用

    命令行

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

    体验热重载(hot reload)

    • 我现在用Android Studio 运行iPhone X模拟器
    • 将pushed改为clicked
    • save(cmd + s) 或 点击⚡️按钮(cmd + \)


      Snip20181217_36.png
    flutter hot reload.gif

    参考:

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

    相关文章

      网友评论

        本文标题:Flutter入门(一) 环境安装,编写Hello World,

        本文链接:https://www.haomeiwen.com/subject/ohoqkqtx.html