Hive: Version solving failed between hive_generator and dartx

Created on 28 Jan 2020  Â·  24Comments  Â·  Source: hivedb/hive

Question
When I try to resolve hive_generator with ^0.7.0 and dartx with ^0.3.0, it ran into error.

Code sample

dependencies:
  dartx: ^0.3.0
dev_dependencies:
  hive_generator: ^0.7.0

Version

  • Flutter version: 1.12.13+hotfix.7
  • Hive version: hive 1.3.0, hive_flutter 0.3.0

image

question

Most helpful comment

Thanks for the info. In the future I will release a new version of all the packages simultaneously. Until then please use

dependency_overrides:
  dartx: ^0.3.0

All 24 comments

Thanks for the info. In the future I will release a new version of all the packages simultaneously. Until then please use

dependency_overrides:
  dartx: ^0.3.0

Since the Flutter master upgrade yesterday 31/03/2020 I get the same issue:

Because no versions of hive_generator match >0.7.0+2 <0.8.0 and hive_generator 0.7.0+2 depends on dartx ^0.2.0, hive_generator ^0.7.0+2 requires dartx ^0.2.0.
And because no versions of dartx match >0.2.0 <0.3.0, hive_generator ^0.7.0+2 requires dartx 0.2.0.
And because dartx 0.2.0 depends on quiver >=2.0.3 <2.1.0 and every version of flutter_test from sdk depends on quiver 2.1.3, hive_generator ^0.7.0+2 is incompatible with flutter_test from sdk.

related pubspec.yml
dartz: ^0.3.0
hive: ^1.4.1+1
hive_flutter: ^0.3.0+2

dev_dependencies:
build_runner:
hive_generator: ^0.7.0+2

And because dartx 0.2.0 depends on quiver >=2.0.3 <2.1.0 and every version of flutter_test from sdk depends on quiver 2.1.3, hive_generator ^0.7.0+2 is incompatible with flutter_test from sdk.

I think that requires you to override quiver.

And because dartx 0.2.0 depends on quiver >=2.0.3 <2.1.0 and every version of flutter_test from sdk depends on quiver 2.1.3, hive_generator ^0.7.0+2 is incompatible with flutter_test from sdk.

I think that requires you to override quiver.

Thank you for the suggestion, I wish I knew what that means. I've tried adding a reference to quiver, but I can't get it to compile and run. Only work around is to comment out the hive_generator in dev_dependencies.

Thanks for the solution @leisim

Got this after downloading the flutter master from last night:
Running "flutter pub get" ...
Because hive_generator >=0.6.0 depends on dartx ^0.2.0 which depends on characters ^0.3.0, hive_generator >=0.6.0 requires characters ^0.3.0.

And because every version of flutter_test from sdk depends on characters 1.0.0, hive_generator >=0.6.0 is incompatible with flutter_test from sdk.

So, because your app depends on both flutter_test any from sdk and hive_generator ^0.7.0+2, version solving failed.
pub get failed (1; So, because your app depends on both flutter_test any from sdk and hive_generator ^0.7.0+2, version solving failed.)

Same issue

Since @leisim has tons of works to deal with, anyone who's facing this issue please paste your key references about the conflict packages, and I'll try to help you solved it since I've done a lot in solving problems like this. 😄

Any chance of a new tag that resolves this? So we don't all need to add hacks to pubspec?

Lots (10+) of issues relating to this, I nearly gave up Hive before I started because it's incompatible...

Any chance of a new tag that resolves this? So we don't all need to add hacks to pubspec?

The only way to achieve this is using to overrides.

Lots (10+) of issues relating to this, I nearly gave up Hive before I started because it's incompatible...

Currently I'm using dartx on Flutter SDK's upper to 1.17.x and no compatible issues happened.

dependency_overrides:
    path: ^1.6.4
    dartx: ^0.4.0

This worked for me

dependency_overrides:
    path: ^1.6.4
    dartx: ^0.4.0

This worked for me

This is not working for me. I am getting the below error while running 'flutter pub get'

The current Dart SDK version is 2.9.1.

Because every version of hive_generator from git depends on analyzer >=0.40.0 <2.0.0 and build >=1.2.1 <1.5.0 depends on analyzer >=0.35.0 <0.40.0, hive_generator from git is incompatible with build >=1.2.1 <1.5.0.
And because build_runner >=1.10.0 <1.10.2 depends on build >=1.3.0 <1.4.0 and build_runner >=1.10.2 requires SDK version >=2.10.0-0.0 <3.0.0, hive_generator from git is incompatible with build_runner >=1.10.0.
So, because contacts_hive depends on both hive_generator from git and build_runner ^1.10.0, version solving failed.
pub get failed (1; So, because contacts_hive depends on both hive_generator from git and build_runner ^1.10.0, version solving failed.)

It would be helpful if you post your pubsec.yaml file details. I am posting my pubsec.yaml file for your reference.

name: contacts_hive
description: A HiveDB sample project that demonstrates TypeAdapter functionality.

version: 1.0.0+1

environment:
sdk: ">=2.6.0 <3.0.0"

dependency_overrides:
path: ^1.6.4
dartx: ^0.4.0

dependencies:
flutter:
sdk: flutter
hive:
hive_flutter:
git:
url: git://github.com/hivedb/hive.git
path: hive_flutter

dev_dependencies:
hive_generator:
git:
url: git://github.com/hivedb/hive.git
path: hive_generator
build_runner: ^1.10.0

flutter:
uses-material-design: true

The current Dart SDK version is 2.9.1.

Can you try hive_generator: 0.7.3 ?

The current Dart SDK version is 2.9.1.

Can you try hive_generator: 0.7.3 ?

Thanks, worked for me.

I'm seeing similar issue. Needed to update some dependencies because of the firebase crashlytics update requirements and now I'm running into problems.

General Info

Flutter 1.22.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d408d302e2 (9 days ago) • 2020-09-29 11:49:17 -0700
Engine • revision 5babba6c4d
Tools • Dart 2.10.0

pubspec

environment:
  sdk: ">=2.6.0 <3.0.0"

dependencies:
  logging: ^0.11.4
  dio_http_cache: ^0.2.6
  dio_http2_adapter: ^1.0.0
  cached_network_image: ^2.0.0
  firebase_core: 0.5.0+1
  firebase_crashlytics: ^0.2.1
  hive: ^1.4.1+1  
  hive_flutter: ^0.3.0+2
  path_provider: ^1.6.5
  polygon_clipper: ^1.0.2
  async: ^2.4.0
  uuid: ^2.0.4
  image_picker: ^0.6.6+1
  xml: ^3.6.1
  provider: ^4.0.4
  animations: ^1.1.2
  intl: ^0.16.1
  collection: ^1.14.11
  url_launcher: ^5.4.2
  package_info: ^0.4.0+16
  google_fonts: ^1.0.0
  html_unescape: ^1.0.1+3
  flutter:
    sdk: flutter

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

dev_dependencies:
  analyzer: ^0.40.4
  hive_generator: 0.7.3
  build_runner: ^1.8.0
  flutter_launcher_icons: "^0.7.3"
  flutter_test:
    sdk: flutter

# TODO Workaround for pub get issues. Follow https://github.com/hivedb/hive/issues/268 to see what's the actual fix
dependency_overrides:
  path: ^1.6.4
  dartx: ^0.4.0


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
   - assets/
   - assets/icons/
   - google_fonts/

error

flutter pub get
Because every version of flutter_test from sdk depends on typed_data 1.3.0-nullsafety.3 which depends on collection >=1.15.0-nullsafety <1.15.0, every version of flutter_test 
from sdk requires collection >=1.15.0-nullsafety <1.15.0.
And because dartx >=0.2.0 <0.5.0 depends on collection >=1.14.11 <1.15.0, flutter_test from sdk is incompatible with dartx >=0.2.0 <0.5.0.
So, because <> depends on both flutter_test any from sdk and dartx ^0.4.0, version solving failed.
Running "flutter pub get" in <>...
pub get failed (1; So, <> depends on both flutter_test any from sdk and dartx ^0.4.0, version solving failed.)

Can anyone help with what should be the "hack" for dependencies override to get my project up and working again?

@mkieres Can you try collection: any ?

@AlexV525 I just tried your suggestion with setting collection package to any but unfortunately I'm getting the same result:

flutter pub get
Because every version of flutter_test from sdk depends on typed_data 1.3.0-nullsafety.3 which depends on collection >=1.15.0-nullsafety <1.15.0, every version of flutter_test 
from sdk requires collection >=1.15.0-nullsafety <1.15.0.
And because dartx >=0.2.0 <0.5.0 depends on collection >=1.14.11 <1.15.0, flutter_test from sdk is incompatible with dartx >=0.2.0 <0.5.0.
So, because <> depends on both flutter_test any from sdk and dartx ^0.4.0, version solving failed.
Running "flutter pub get" in <>...
pub get failed (1; So, because <> depends on both flutter_test any from sdk and dartx ^0.4.0, version solving failed.)

Do I need to clean the package cache before I run the pub get?

@mkieres Where did you put it at? By using any I mean define this under the override part.

@AlexV525 Thanks for your quick response. I changed the version of the collection package to any in the dependencies section. Once I added it to the dependency_overrides section it looks like the pub get command is working fine.

However, I'm still seeing issues when I try to generate adapters with by running the following flutter packages pub run build_runner build -v. I can provide logs if anyone is willing to help but I'm unsure if it belongs to this issue or not.

We should focus on dependencies override issue here only. :)

Hello @AlexV525,

I come across with the similar issue, from above solution I gave it some try, but unfortunately its not works for me. I don't know where I did make mistake.

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
  jitsi_meet: ^0.2.5
  flutter_bloc: ^3.2.0
  convex_bottom_bar: ^2.2.3
  dio: ^3.0.7
  hive: ^1.4.1+1
  hive_flutter: ^0.3.0+2
  built_value: ^7.1.0
  equatable: ^1.2.0
  provider: ^4.0.0
  firebase_auth: ^0.16.1
  flutter_facebook_login: ^3.0.0
  google_sign_in: ^4.5.1
  country_code_picker: ^1.4.0
  pin_entry_text_field: ^0.1.4
  fluttertoast: ^4.0.1
  flutter_keyboard_visibility: ^3.2.1
  intro_slider: ^2.3.1
  after_layout: ^1.0.7+2
  flutter_html: ^1.0.0
  share: ^0.6.4+3
  onesignal_flutter: ^2.6.0
  app_review: ^1.1.2
  image_picker: ^0.6.7+4
  flutter_spinkit: "^4.1.2"
  flutter_pagewise: ^1.2.3
  admob_flutter: ^0.3.4
  connectivity: ^0.4.9
  collection: ^1.14.11

dev_dependencies:
  flutter_launcher_icons: "^0.7.3"
  flutter_test:
    sdk: flutter
  hive_generator: 0.7.3
  build_runner:
dependency_overrides:
  path: ^1.6.4
  dartx: ^0.4.0
flutter_icons:
  android: "launcher_icon"
  ios: false
  image_path: "assets/images/android_launcher_icon.png"

image

error message:

Because every version of flutter_test from sdk depends on typed_data 1.3.0 which depends on collection ^1.15.0, 
every version of flutter_test from sdk requires collection ^1.15.0.
And because dartx >=0.2.0 <0.5.0 depends on collection >=1.14.11 <1.15.0, 
flutter_test from sdk is incompatible with dartx >=0.2.0 <0.5.0.
So, because spagreen depends on both flutter_test any from sdk and dartx ^0.4.0, version solving failed.
pub get failed (1; So, because spagreen depends on both flutter_test any from sdk and dartx ^0.4.0, version solving failed.)

Thank you!!

I come across with the similar issue, from above solution I gave it some try, but unfortunately its not works for me. I don't know where I did make mistake.

@hitesh-dhamshaniya dartx seems published with a nnbd version 0.6.0, could you try to upgrade to this version first?

@AlexV525 Thank you for your quick response. The error was solved by an update the version. However to compile and run my project I have to make a few more changes :)

As the issue itself seems no longer an issue, I'm going to close as solved. For people that don't have this issue anymore, you can unsubscribe for less spam notifications.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxim-saplin picture maxim-saplin  Â·  3Comments

yannickvg picture yannickvg  Â·  4Comments

SergeShkurko picture SergeShkurko  Â·  4Comments

kaboc picture kaboc  Â·  3Comments

Ferdzzzzzzzz picture Ferdzzzzzzzz  Â·  3Comments