-
Error on line 6, column 5 of pubspec.yaml: A dependency may only have one source.
sdk: flutter
^^^^^^^^^^^^^
方法:dio要引入要对齐
-
-Waiting for another flutter command to release the startup lock。
方法:
1、打开flutter的安装目录/bin/cache/
2、删除lockfile文件
3、重启AndroidStudio -
由于在国内访问Flutter有时可能会受到限制,Flutter官方为中国开发者搭建了临时镜像,大家可以将如下环境变量加入到用户环境变量中:
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn -
type ‘Future<Response>’ is not a subtype of type 'Response
void getHttp() async {
try {
Response response = DioManager.singleton.dio.get("http://www.baidu.com");
print(response);
} catch (e) {
print(e);
}
}
网络请求返回错误
原因:少了 await
应该是
void getHttp() async {
try {
Response response = await DioManager.singleton.dio.get("http://www.baidu.com");
print(response);
} catch (e) {
print(e);
}
}