Dart Packages: Solve dep. conflicts

I have a Dart/Flutter project with dependencies graphql: '^2.1.1-beta.5' and flutter_bloc: ^3.0.0, which require different versions of rxdart that cause version solving to fail. My temporary fix is to downgrade flutter_bloc to ^2.1.1, but is there a way to use the latest version of flutter_bloc?

dependencies:
  graphql: '^2.1.1-beta.5'
  flutter_bloc: ^3.0.0

Error message:

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.

To use the latest version of flutter_bloc while also keeping the graphql dependency, you can add an explicit dependency on rxdart in your pubspec.yaml file with the version required by graphql. Here’s an example:

dependencies:
  graphql: '^2.1.1-beta.5'
  flutter_bloc: ^3.0.0
  rxdart: ^0.22.0
dependency_overrides:
  rxdart: ^0.22.0

By adding the rxdart dependency explicitly and also overriding it to the required version, the version solving issue should be resolved and you can use the latest version of flutter_bloc.