Search code examples
flutterdartdependenciespubspec

Flutter: chopper_generator >=3.0.4 is incompatible with moor_generator ^4.1.0, how to solve?


I updated flutter to the latest version:

PS C:\Users\pc> flutter --version
Flutter 2.0.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8962f6dc68 (8 days ago) • 2021-03-11 13:22:20 -0800
Engine • revision 5d8bf811b3
Tools • Dart 2.12.1

And ran flutter doctor with no issues:

PS C:\Users\pc> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.2, on Microsoft Windows [Version 10.0.19042.867], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
[√] VS Code (version 1.51.1)
[√] Connected device (3 available)

• No issues found!

So I created a new flutter project, and brought the dependencies and packages (latest versions following the docs of each) that I know I'm gonna use:

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_bloc: ^6.1.3
  moor: ^4.1.0
  sqlite3_flutter_libs: ^0.4.1
  path_provider: ^2.0.1
  path: ^1.8.0
  firebase_messaging: ^9.0.0
  equatable: ^2.0.0
  multi_image_picker: ^4.8.0
  chopper: ^3.0.2


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^1.0.0
  chopper_generator: ^3.0.4
  moor_generator: ^4.1.0

But when I run pub get, I got this issue, which says that chopper_generator and moor_generator are incompatible, How to solve this? how could I find the compatible versions? it's hard to find the changelog of each package in its docs, and I don't seem to find any details about analyzer version... am I going to need to give up one of the packages?

Because analyzer_plugin >=0.2.5 <0.4.0 depends on analyzer ^0.39.12 and 
analyzer_plugin >=0.4.0 depends on analyzer ^0.41.0, analyzer_plugin >=0.2.5 
requires analyzer ^0.39.12 or ^0.41.0.
And because chopper_generator >=3.0.6 depends on analyzer ^0.40.4, 
analyzer_plugin >=0.2.5 is incompatible with chopper_generator >=3.0.6.
And because chopper_generator >=3.0.5 <3.0.6 depends on analyzer ^0.39.8 and 
chopper_generator >=3.0.4 <3.0.5 depends on analyzer ^0.39.0, if 
analyzer_plugin >=0.2.5 and chopper_generator >=3.0.4 then analyzer ^0.39.0.
And because moor_generator >=4.1.0 <4.2.0 depends on analyzer >=0.40.0 
<0.43.0 and moor_generator >=4.0.0-dev <4.2.0 depends on analyzer_plugin 
>=0.3.0 <0.5.0, chopper_generator >=3.0.4 is incompatible with moor_generator 
>=4.1.0 <4.2.0.
And because no versions of moor_generator match >4.2.0 <5.0.0 and 
moor_generator 4.2.0 depends on build_resolvers ^2.0.0, if chopper_generator 
>=3.0.4 and moor_generator ^4.1.0 then build_resolvers ^2.0.0.
And because no versions of build_resolvers match >2.0.0 <3.0.0 and 
build_resolvers 2.0.0 depends on logging ^1.0.0, if chopper_generator >=3.0.4 
and moor_generator ^4.1.0 then logging ^1.0.0.
Because chopper_generator >=3.0.5 depends on logging ^0.11.4 and 
chopper_generator >=0.1.0 <3.0.5 depends on logging ^0.11.0, 
chopper_generator >=0.1.0 requires logging ^0.11.0.
Thus, chopper_generator >=3.0.4 is incompatible with moor_generator ^4.1.0.
So, because fournisseur depends on both chopper_generator ^3.0.4 and 
moor_generator ^4.1.0, version solving failed.
pub get failed (1; So, because fournisseur depends on both chopper_generator 
^3.0.4 and moor_generator ^4.1.0, version solving failed.)
Process finished with exit code 1

Solution

  • A possible solution would be to decrease the version of one of the libraries until they are compatible with each other.