Home > Net >  depends on both floor_generator ^1.2.0 and retrofit_generator ^4.0.1, version solving failed
depends on both floor_generator ^1.2.0 and retrofit_generator ^4.0.1, version solving failed

Time:05-05

I am using retrofit_generator and floor_generator in my application.

retrofit_generator: ^4.0.1
floor_generator: ^1.2.0

When I am trying to run flutter packages pub run build_runner build getting this error:

Because no versions of retrofit_generator match >4.0.1 <5.0.0 and retrofit_generator 4.0.1 depends on analyzer ^3.0.0, re
trofit_generator ^4.0.1 requires analyzer ^3.0.0.
And because floor_generator >=1.2.0 depends on analyzer ^2.2.0, retrofit_generator ^4.0.1 is incompatible with floor_gene
rator >=1.2.0.
So, because my_flutter_app depends on both floor_generator ^1.2.0 and retrofit_generator ^4.0.1, version solving failed.
Running "flutter pub get" in my_flutter_app...
pub get failed (1; So, because my_flutter_app depends on both floor_generator ^1.2.0 and retrofit_generator ^4.0.1,
version solving failed.)

Also, tried to add analyzer: ^3.0.0 in dev_dependencies then:

Because floor_generator >=1.2.0 depends on analyzer ^2.2.0 and my_flutter_app depends on analyzer ^3.0.0, floor_generator >=1.2.0 is forbidden.
So, because my_flutter_app depends on floor_generator ^1.2.0, version solving failed.
pub get failed (1; So, because my_flutter_app depends on floor_generator ^1.2.0, version solving failed.)
exit code 1

How can we use both without errors?

CodePudding user response:

Checking the retrofit_generator CHANGELOG, you will see there was a breaking change on version 4.0.0 making the library depend on version 3.0.0 but floor_generator hasn't been updated for the last 7 months and it depends on older version of analyzer.

Possible solution would be to downgrade retrofit_generator in a version prior to the breaking change, or wait till the publisher of floor_generator updates its dependencies.

  • Related