Milad-Akarie / auto_route_library

Flutter route generator
MIT License
1.59k stars 405 forks source link

Auto_Route 2.3.0 -> analyzer 2.0.0 workaround #648

Closed Milad-Akarie closed 2 years ago

Milad-Akarie commented 3 years ago

Since current version of auto_route 2.3.0 depends on analyzer 2.0.0which depends on meta 1.7.0. and current version of flutter stable is still constrained to meta 1.3.0

you probably need to override meta version until flutter stable is updated by adding the following to your pubspec file.

dependency_overrides:
  meta: ^1.7.0
luqmanhakem commented 3 years ago

Thank you for the heads up. Much appreciated.

Feggah commented 3 years ago

@Milad-Akarie when trying to do this workaround, another issue was raised between auto_route_generator and mocktail:

[src/exposure] flutter pub get
Running "flutter pub get" in exposure...                        
Because test >=1.16.0-nullsafety.19 <1.16.6 depends on test_api 0.2.19 and test >=1.16.6 <1.17.10 depends on analyzer ^1.0.0, test >=1.16.0-nullsafety.19 <1.17.10 requires test_api 0.2.19 or analyzer ^1.0.0.

And because test >=1.17.10 <1.17.11 depends on test_api 0.4.2 and test >=1.17.11 depends on test_api 0.4.3, test >=1.16.0-nullsafety.19 requires test_api 0.2.19 or 0.4.2 or 0.4.3 or analyzer ^1.0.0.
Because no versions of mocktail match >0.1.4 <0.2.0 and mocktail 0.1.4 depends on test ^1.16.0, mocktail ^0.1.4 requires test ^1.16.0.

Thus, mocktail ^0.1.4 requires test_api 0.2.19 or 0.4.2 or 0.4.3 or analyzer ^1.0.0.

And because auto_route_generator >=2.3.0 depends on analyzer ^2.0.0, if mocktail ^0.1.4 and auto_route_generator >=2.3.0 then test_api 0.2.19 or 0.4.2 or 0.4.3.
And because exposure depends on flutter_test any from sdk which depends on test_api 0.3.0, mocktail ^0.1.4 is incompatible with auto_route_generator >=2.3.0.

So, because exposure depends on both auto_route_generator ^2.3.0 and mocktail ^0.1.4, version solving failed.
pub get failed (1; So, because exposure depends on both auto_route_generator ^2.3.0 and mocktail ^0.1.4, version solving failed.)
exit code 1

So I needed to update the dependency_override to:

dependency_overrides:
  meta: ^1.7.0
  test_api: ^0.4.2

This can be useful if anyone is using mocktail for tests 🙂

Just in case if anyone is interested in my full list of dependencies, it is:

dependencies:
  flutter:
    sdk: flutter
  auto_route: ^2.3.0
  cloud_firestore: ^2.4.0
  cupertino_icons: ^1.0.2
  dartz: ^0.10.0-nullsafety.2
  dio: ^4.0.0
  equatable: ^2.0.3
  firebase_core: ^1.4.0
  flutter_bloc: ^7.1.0
  flutter_svg: ^0.22.0
  freezed_annotation: ^0.14.2
  get_it: ^7.2.0
  injectable: ^1.4.1
  internet_connection_checker: ^0.0.1+2
  intl: ^0.17.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  auto_route_generator: ^2.3.0
  build_runner:
  flutter_launcher_icons: ^0.9.1
  freezed: ^0.14.2
  injectable_generator: ^1.4.1
  lint: ^1.5.3
  mocktail: ^0.1.4
github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions