当使用带有pub get的Flutter包时,我可以采取哪些步骤来解决版本冲突错误?

unguejic  于 2023-06-07  发布在  Flutter
关注(0)|答案(3)|浏览(379)

当我输入pub get in flutter时,我会出现一些错误

`**Resolving dependencies...
Because every version of month_year_picker depends on flutter_localizations from sdk which depends on intl 0.18.1, every version of month_year_picker requires intl 0.18.1.
So, because assingment depends on both intl ^0.17.0 and month_year_picker ^0.2.0+3, version solving failed.**`
**Because month_year_picker <0.3.0+1 depends on intl ^0.17.0 and assingment depends on intl ^0.18.1, month_year_picker <0.3.0+1 is forbidden.
So, because assingment depends on month_year_picker ^0.2.0+3, version solving failed.**

我已经尝试过降级和升级intl包,但它仍然显示错误,我无法在android Studio中使用pub get

tyky79it

tyky79it1#

删除其中一个冲突的软件包,然后pub get,并使用命令安装该软件包:flutter pub add <packagename>

w8f9ii69

w8f9ii692#

1.把这个加到你的pubspec里。

dependencies:
  assingment:
    dependency_overrides:
      month_year_picker: ^0.3.0+1

1.运行flutter pub get

ggazkfy8

ggazkfy83#

您可以使用any来代替特定的软件包版本,但是,特别是当您想要发布应用程序时,不建议使用any

dependencies:
  ...
  some_dependency: any
  ...

此外,Version Lens在这种情况下是一个有用的扩展。

相关问题