5

I've been getting an error ever since I tried adding integration_test package along with get_test and it's primarily due to the fact that just_audio depends on crypto: ^3.0.0 while integration_test depends on crypto: ^2.1.5.

I tried to look online to see if it's possible to only install dependencies without dev_dependencies however it seems like flutter pub cli tool doesn't support that yet based on this issue.

Here is my pubspec.yaml

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  share: ^2.0.1
  get:
  get_storage:
  shared_preferences: ^2.0.5
  audio_service: 0.17.0-nullsafety.0
  just_audio: ^0.7.4

dev_dependencies:
  flutter_test:
    sdk: flutter

  get_test: ^3.13.3
  integration_test: ^1.0.2+1
  test: ^1.14.4

This is the error I am getting.

Because every version of integration_test depends on flutter_driver any from sdk which depends on crypto 2.1.5, every version of integration_test requires crypto 2.1.5.
And because just_audio 0.7.4 depends on crypto ^3.0.0 and no versions of just_audio match >0.7.4 <0.8.0, integration_test is incompatible with just_audio ^0.7.4.
So, because egy_fm_radio depends on both just_audio ^0.7.4 and integration_test ^1.0.2+1, version solving failed.
pub get failed (1; So, because egy_fm_radio depends on both just_audio ^0.7.4 and integration_test ^1.0.2+1, version solving failed.)
Andrew Gabriel
  • 102
  • 2
  • 6

2 Answers2

0

I think this specific issue could have been be resolved by updating the Flutter SDK to the latest (>=2.2.0), but if there's anybody experiencing a similar issue, consider using Dependency overrides to override dependencies of built-in packages such as integration_test and flutter_driver.

dependency_overrides:
  crypto: ^3.0.0

Note that this involves some risk and pub will show you a warning during dependency resolution.

Swift Kim
  • 396
  • 1
  • 8
0

Looking through your pubspec.yaml it appears the problem lies within the crypto dependency mismatch.

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  share: ^2.0.1
  crypto: 3.0.1
  get:
  get_storage:
  shared_preferences: ^2.0.5
  audio_service: 0.17.0-nullsafety.0
  just_audio: ^0.7.4

dev_dependencies:
  flutter_test:
    sdk: flutter

  get_test: ^3.13.3
  integration_test: ^1.0.2+1
  test: ^1.14.4

What happens is that when you use so many packages, some of those packages use some other packages. It may so happen that two or more packages use the same package.So, it creates an error incase of mismatch because you cannot have two different versions of the same package.

aksyuma
  • 2,957
  • 1
  • 15
  • 29