Flutter image_picker包安装出错,错误信息为“版本解析失败”。

huangapple go评论94阅读模式
英文:

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 &lt;0.7.0-nullsafety doesn&#39;t support null safety and image_picker &gt;=0.8.4 &lt;0.8.6 depends   
  on image_picker_platform_interface ^2.3.0, image_picker &lt;0.7.0-nullsafety or &gt;=0.8.4 &lt;0.8.6-∞ requires     
  image_picker_platform_interface ^2.3.0.
And because image_picker &gt;=0.8.2 &lt;0.8.4 depends on image_picker_platform_interface ^2.2.0, image_picker
  &lt;0.7.0-nullsafety or &gt;=0.8.2 &lt;0.8.6-∞ requires image_picker_platform_interface ^2.2.0.
And because image_picker &gt;=0.8.1 &lt;0.8.2 depends on image_picker_platform_interface ^2.1.0 and image_picker
  &gt;=0.7.0 &lt;0.8.1 depends on image_picker_platform_interface ^2.0.0, image_picker &lt;0.7.0-nullsafety or &gt;=0.7.0  &lt;0.8.6-∞ requires image_picker_platform_interface ^2.0.0.
Because image_picker_platform_interface &gt;=2.0.0-nullsafety &lt;2.0.0 depends on http ^0.13.0-nullsafety.0 and   
  image_picker &gt;=0.7.0-nullsafety &lt;0.7.0 depends on image_picker_platform_interface ^2.0.0-nullsafety,
  image_picker &gt;=0.7.0-nullsafety &lt;0.7.0 requires http ^0.13.0-nullsafety.0 or
  image_picker_platform_interface ^2.0.0.
Thus, image_picker &lt;0.8.6 requires http ^0.13.0-nullsafety.0 or image_picker_platform_interface ^2.0.0.      
And because image_picker &gt;=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 &gt;=2.0.0 depends on http ^0.13.0 and google_fonts &gt;=4.0.5
  depends on http ^1.0.0, google_fonts &gt;=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 &quot;sdk: &#39;&gt;=1.8.0 &lt;2.0.0 or &gt;=2.0.0-dev.28.0 &lt;3.0.0&#39;&quot; 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: &quot;&gt;=2.12.0 &lt;3.0.0&quot;

答案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

huangapple
  • 本文由 发表于 2023年5月28日 18:27:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76351026.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定