jerryboy1031 / dart_basic_learning

learn basics of Dart language
MIT License
0 stars 0 forks source link

Version conflict #1

Open jerryboy1031 opened 1 year ago

jerryboy1031 commented 1 year ago

snippet of pubspec.yaml file

dev_dependencies:
  flutter_test:
    sdk: flutter
  test: any
  mockito: ^4.1.1+1 
  flutter_launcher_icons: ^0.7.3

Action: Run flutter pub get

Output

Because mockito >=4.1.2 <=5.0.0-nullsafety.7 depends on test_api ^0.2.19-nullsafety and mockito >=4.1.1+1 <4.1.2 depends on test_api >=0.2.1 <0.4.0, mockito >=4.1.1+1 <=5.0.0-nullsafety.7 requires test_api >=0.2.1 <0.4.0. And because every version of flutter_test from sdk depends on test_api 0.4.16, flutter_test from sdk is incompatible with mockito >=4.1.1+1 <=5.0.0-nullsafety.7. So, because fluttube depends on both flutter_test from sdk and mockito ^4.1.1+1, version solving failed. pub get failed

exit code: 1

jerryboy1031 commented 1 year ago

Explain

There's a version conflict between two packages. Both mockito and flutter_test depend on test_api, but they require different versions of test_api.

This error arises when different packages have conflicting requirements for the same dependency.

Solution

Take a look at: How to solve multi dependency version conflicts simply?

The Simplest way:

just remove the version number of both that dependencies and type 'any' without quotes in front of them.

Example:

dev_dependencies:
  flutter_test:
    sdk: flutter
  test: any
  mockito: any
  flutter_launcher_icons: ^0.7.3