英文:
Flutter image_picker package installation throws error "version solving failed."
问题
我正在尝试安装Flutter包"image_picker"。当我运行flutter pub add image_picker
时,我得到以下错误:
当前Dart SDK版本为3.0.1。
因为image_picker <0.7.0-nullsafety不支持空安全,而image_picker > =0.8.4 <0.8.6依赖于image_picker_platform_interface ^2.3.0,所以image_picker <0.7.0-nullsafety或> =0.8.4 <0.8.6-∞需要image_picker_platform_interface ^2.3.0。
而且因为image_picker > =0.8.2 <0.8.4依赖于image_picker_platform_interface ^2.2.0,所以image_picker <0.7.0-nullsafety或> =0.8.2 <0.8.6-∞需要image_picker_platform_interface ^2.2.0。
因为image_picker > =0.8.1 <0.8.2依赖于image_picker_platform_interface ^2.1.0,而image_picker > =0.7.0 <0.8.1依赖于image_picker_platform_interface ^2.0.0,所以image_picker <0.7.0-nullsafety或> =0.7.0 <0.8.6-∞需要image_picker_platform_interface ^2.0.0。
因为image_picker_platform_interface > =2.0.0-nullsafety <2.0.0依赖于http ^0.13.0-nullsafety.0,而image_picker > =0.7.0-nullsafety <0.7.0依赖于image_picker_platform_interface ^2.0.0-nullsafety,所以image_picker > =0.7.0-nullsafety <0.7.0需要http ^0.13.0-nullsafety.0或image_picker_platform_interface ^2.0.0。
因此,image_picker <0.8.6需要http ^0.13.0-nullsafety.0或image_picker_platform_interface ^2.0.0。
而且因为image_picker > =0.8.6依赖于image_picker_platform_interface ^2.6.1,所以每个image_picker版本都需要http ^0.13.0-nullsafety.0或image_picker_platform_interface ^2.0.0。
而image_picker_platform_interface > =2.0.0依赖于http ^0.13.0,而google_fonts > =4.0.5依赖于http ^1.0.0,所以google_fonts > =4.0.5与image_picker不兼容。
因此,因为favorite_places_app依赖于google_fonts ^4.0.5和image_picker任何版本,版本解决失败。
"sdk: '>=1.8.0 <2.0.0 or >=2.0.0-dev.28.0 <3.0.0'"的下限必须为2.12.0或更高,以启用空安全。
有关详细信息,请参见https://dart.dev/null-safety
我还尝试在pubspec.yaml中的依赖项下插入名称来安装该包,但结果相同。
英文:
I am trying to install Flutter package "image_picker". When I run flutter pub add image_picker
I get the following error:
The current Dart SDK version is 3.0.1.
Because image_picker <0.7.0-nullsafety doesn't support null safety and image_picker >=0.8.4 <0.8.6 depends
on image_picker_platform_interface ^2.3.0, image_picker <0.7.0-nullsafety or >=0.8.4 <0.8.6-∞ requires
image_picker_platform_interface ^2.3.0.
And because image_picker >=0.8.2 <0.8.4 depends on image_picker_platform_interface ^2.2.0, image_picker
<0.7.0-nullsafety or >=0.8.2 <0.8.6-∞ requires image_picker_platform_interface ^2.2.0.
And because image_picker >=0.8.1 <0.8.2 depends on image_picker_platform_interface ^2.1.0 and image_picker
>=0.7.0 <0.8.1 depends on image_picker_platform_interface ^2.0.0, image_picker <0.7.0-nullsafety or >=0.7.0 <0.8.6-∞ requires image_picker_platform_interface ^2.0.0.
Because image_picker_platform_interface >=2.0.0-nullsafety <2.0.0 depends on http ^0.13.0-nullsafety.0 and
image_picker >=0.7.0-nullsafety <0.7.0 depends on image_picker_platform_interface ^2.0.0-nullsafety,
image_picker >=0.7.0-nullsafety <0.7.0 requires http ^0.13.0-nullsafety.0 or
image_picker_platform_interface ^2.0.0.
Thus, image_picker <0.8.6 requires http ^0.13.0-nullsafety.0 or image_picker_platform_interface ^2.0.0.
And because image_picker >=0.8.6 depends on image_picker_platform_interface ^2.6.1, every version of
image_picker requires http ^0.13.0-nullsafety.0 or image_picker_platform_interface ^2.0.0.
And because image_picker_platform_interface >=2.0.0 depends on http ^0.13.0 and google_fonts >=4.0.5
depends on http ^1.0.0, google_fonts >=4.0.5 is incompatible with image_picker.
So, because favorite_places_app depends on both google_fonts ^4.0.5 and image_picker any, version solving
failed.
The lower bound of "sdk: '>=1.8.0 <2.0.0 or >=2.0.0-dev.28.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.
For details, see https://dart.dev/null-safety
I also tried installing the package by inserting the name under dependencies in pubspec.yaml, but same result.
答案1
得分: 1
你需要更新你的pubspec.yaml文件以启用空安全功能。进入pubspec.yaml文件并在environment下更改sdk版本。
environment:
sdk: ">=2.12.0 <3.0.0"
英文:
You need to update your pubspec.yaml file to enable null safety feature. Go to pubspec.yaml file and change sdk version under environment
environment:
sdk: ">=2.12.0 <3.0.0"
答案2
得分: 0
请在 'pubpec.yaml' 文件中调整您的 http 或 google_fonts 依赖版本。
例如> http: ^1.0.1 => ^0.13.0
英文:
adjust your http or google_fonts dependency versions in 'pubpec.yaml' file.
ex> http: ^1.0.1 => ^0.13.0
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论