在國內環境, 搭建Flutter web環境費了很大力氣,以下就詳細解答搭建程序,
第一步: 下載beta版
https://flutter.cn/docs/development/tools/sdk/releases 版本串列里找到beta channel最新版, 我這里用的是1.22.0-12.1.pre, 大約700MB,解壓到安裝目錄, 推薦放到 C:/src/flutter
第二步:
設定 Path 環境變數 C:/src/flutter/bin
設定 dart_pub, flutter 環境變數(國內環境需要使用鏡像, 詳情見下邊參考鏈接)
$ export PUB_HOSTED_URL=https://pub.flutter-io.cn
$ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

第三步: 設定支持web: flutter config --enable-web
第四步:cmd運行: flutter docter, 根據要求安裝相關工具,例如visual studio code等,
第五步: cmd運行: flutter devices, 這里應該會輸出一個名為chrome等的web設備資訊,
第六步: flutter create myapp && cd myapp && flutter run -d chrome
這里可能會有報錯資訊: NoSuchMethodError: The method 'toFilePath' was called on null. 這是flutter的bug,等待更新
參考鏈接:
https://flutter.cn/docs/get-started/web
https://flutter.cn/community/china
https://dart.cn/samples
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/116565.html
標籤:其他
上一篇:申請瑞士VQF牌照需要什么資料
