我正在尝试安装Flutter软件包“image_picker”。当我运行flutter pub add image_picker
时,我得到以下错误:
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
我还尝试通过在pubspec.yaml中的dependencies下插入名称来安装软件包,但结果相同。
1条答案
按热度按时间3htmauhk1#
您需要更新pubspec.yaml文件以启用空安全特性。转到pubspec.yaml文件并在环境下更改sdk版本