程序员

Flutter 填过的坑

2020-07-02  本文已影响0人  比尔王BillWang

进入AS后,device显示loading,点击运行提示无法找到设备

1 开启模拟器
2 运行flutter devices 能够找到设备
3 重启as

无法使用flutter

AS要3.6 才能使用Flutter

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

因为墙的原因,建议按照guide填写国内的源。
mac Terminal:

cd ~
open .bash_profile

添加下面两行环境变量

#国内用户需要设置
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网络请求返回异常,但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'

上一篇下一篇

猜你喜欢

热点阅读