【无标题】

总结:
1.检查依赖包中的缩进是否正确
2.编译器自动运行->flutter pub get
3.尝试升级 sdk,
4.尝试更改环境变量
5.删除.idea 文件 .dart_tool文件
6.重启IDE

推荐优先执行步骤1–>5–>6

下面是错误过程

Try creating the file referenced by the URI, or Try using a URI for a file that does exist.

一、尝试更新flutter sdk(但不行)
flutter upgrade --force

二、修改pubspec.yaml文件
dependencies:
flutter:
sdk: flutter
flutter_localizations: //此行新增
sdk: flutter // 此行新增

三、卡在downloading
等待几分钟后出现下载,(证明本身url没问题)
如果需要更换地址:如下
上海交通大学
FLUTTER_STORAGE_BASE_URL: https://mirrors.sjtug.sjtu.edu.cn/
PUB_HOSTED_URL: https://dart-pub.mirrors.sjtug.sjtu.edu.cn/

Flutter 社区
FLUTTER_STORAGE_BASE_URL: https://storage.flutter-io.cn
PUB_HOSTED_URL: https://pub.flutter-io.cn
清华大学 TUNA 协会
FLUTTER_STORAGE_BASE_URL: https://mirrors.tuna.tsinghua.edu.cn/flutter
PUB_HOSTED_URL: https://mirrors.tuna.tsinghua.edu.cn/dart-pub

上海交通大学
FLUTTER_STORAGE_BASE_URL: https://mirrors.sjtug.sjtu.edu.cn/
PUB_HOSTED_URL: https://dart-pub.mirrors.sjtug.sjtu.edu.cn/

四、手动删除两个文件

五、自动执行,或手动在”终端“ flutter pub get或flutter packages get

参考csdn博客连接地址:
https://blog.csdn.net/qq_42030756/article/details/120042207

你可能感兴趣的:(flutter,笔记,flutter)