介绍
我有新项目。
我是pub.spec
通过Android studio官方flutter插件生成的。
在配置中没有手动添加/更改任何内容。
问题
当我运行时pub get
,我收到错误:
The current Dart SDK version is 3.1.3.
Because my_app depends on dependencies any which doesn't support null safety, version solving failed.
The lower bound of "sdk: '>=2.0.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.
我的 pub.spec
name: my_app
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0
environment:
sdk: '>=3.1.3 <4.0.0'
dependencies:
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
assets:
- assets/images/icons/
问题
1 如何解决?
2 是什么意思depends on dependencies any
?
你
pubspec.yaml
似乎被什么事情弄乱了。你有dependencies
两次,所以它实际上尝试安装一个名为的包dependencies
,该包实际上确实存在,但非常旧且已弃用(并且不支持空安全)。尝试使用这个代替: