Dart套件:依赖冲突 [英] Dart Packages: Dependency conflicts
问题描述
在Dart/Flutter项目中,我有
In a Dart/Flutter project, I have
dependencies:
graphql: '^2.1.1-beta.5'
flutter_bloc: ^3.0.0
作为依赖项.但是, graphql
取决于 rxdart:^ 0.22.0
,而 flutter_bloc
取决于 rxdart:^ 0.23.0
,这给了我错误:
as dependencies. However, graphql
depends on rxdart: ^0.22.0
and flutter_bloc
depends on rxdart: ^0.23.0
, which give me error:
Because flutter_bloc >=3.0.0 depends on bloc ^3.0.0 which depends on rxdart ^0.23.0, flutter_bloc >=3.0.0 requires rxdart ^0.23.0.
And because graphql 2.1.1-beta.5 depends on rxdart ^0.22.0 and no versions of graphql match >2.1.1-beta.5 <3.0.0, flutter_bloc >=3.0.0 is incompatible with graphql ^2.1.1-beta.5.
So, because com.myapp depends on both graphql ^2.1.1-beta.5 and flutter_bloc ^3.0.0, version solving failed.
我的临时解决方法是将 flutter_bloc
降级为 ^ 2.1.1
,该版本使用 rxdart ^ 0.23.0
.但是,如果我想使用 flutter_bloc
的最新最好的版本,最好的解决方案是什么?
My temporary fix is to downgrade flutter_bloc
to ^2.1.1
, which uses rxdart ^0.23.0
. But if I want to use the latest and greatest version of flutter_bloc
, what is the best solution?
谢谢!
推荐答案
您可以使用依赖性覆盖 pubspec.yaml
中的:
You can use dependency overrides in pubspec.yaml
:
dependency_overrides:
rx_dart: ^0.23.0
请注意,如果您这样做,依赖于另一个版本的依赖项的插件可能会损坏.
Note that plugins that depend on another version of the dependency you override can break if you do this.
这篇关于Dart套件:依赖冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!