Flutter 填過的坑

進入AS后,device顯示loading,點擊運行提示無法找到設備

1 開啟模擬器
2 運行flutter devices 能夠找到設備
3 重啟as

無法使用flutter

AS要3.6 才能使用Flutter

執(zhí)行flutter 命令提示 (This is taking an unexpectedly long time.)

因為墻的原因,建議按照guide填寫國內(nèi)的源。
mac Terminal:

cd ~
open .bash_profile

添加下面兩行環(huán)境變量

#國內(nèi)用戶需要設置
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn 

package:http/http.dart 找不到

dependencies:
  http: ^0.11.0      // --加入這行 
  flutter:
    sdk: flutter

https://blog.csdn.net/Dreamfine/article/details/83859915

Dio網(wǎng)絡請求返回異常,但Flutter HttpClient正常訪問

DioError [DioErrorType.DEFAULT]: Error on line 1, column 17: Invalid media type: expected no more input.

原因,本地服務器,application/json,charset=utf-8 逗號應該改為分號

    return HttpResponse(json.dumps(result, ensure_ascii=False), content_type="application/json;charset=utf-8")

Failed assertion: line xxx pos xxx: 'data != null'

錯誤示范

var text = null;
new Text(text);

傳入的Text為空就會導致這個錯誤,解決辦法就是不傳空值

Failed assertion: line xxx pos xxx: 'data != null'

最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內(nèi)容