Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riverpod_lint conflicts with flutter_test #3313

Closed
hpelitebook745G2 opened this issue Feb 2, 2024 · 5 comments
Closed

riverpod_lint conflicts with flutter_test #3313

hpelitebook745G2 opened this issue Feb 2, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@hpelitebook745G2
Copy link

Describe the bug
riverpod_lint cannot be installed if there is flutter_test in pubspec.yaml

To Reproduce

  1. Create a fresh flutter project
  2. In the default pubspec.yaml, it has:
dev_dependencies:
  flutter_test:
    sdk: flutter

Don't touch this, yet!
3. Install the following:

flutter pub add hooks_riverpod
flutter pub add flutter_hooks
flutter pub add riverpod_annotation
flutter pub add dev:riverpod_generator
flutter pub add dev:build_runner
flutter pub add dev:custom_lint
flutter pub add dev:riverpod_lint // this one causes the error

Here's the error:

Note: vm_service is pinned to version 14.0.0 by flutter_test from the flutter SDK.
See https://dart.dev/go/sdk-version-pinning for details.


    Because riverpod_lint <1.0.1 depends on riverpod_analyzer_utils ^0.0.1 and riverpod_lint >=1.0.1 <1.1.0 depends on riverpod_analyzer_utils ^0.0.2, riverpod_lint <1.1.0 requires riverpod_analyzer_utils ^0.0.1.
    And because riverpod_lint >=1.1.0 <1.1.3 depends on custom_lint_builder ^0.2.12 and riverpod_lint >=1.1.3 <1.1.4 depends on riverpod_analyzer_utils ^0.1.2, riverpod_lint <1.1.4 requires riverpod_analyzer_utils ^0.0.1 or
      ^0.1.2 or custom_lint_builder ^0.2.12.
    And because riverpod_lint >=1.1.4 <1.1.7 depends on custom_lint_builder ^0.3.2 and riverpod_lint ^1.3.2 depends on riverpod_analyzer_utils ^0.3.1, riverpod_lint <1.1.7-∞ or >=1.3.2 <2.0.0-∞ requires custom_lint_builder
      ^0.2.12 or ^0.3.2 or riverpod_analyzer_utils ^0.0.1 or ^0.1.2 or ^0.3.1.
    And because riverpod_lint >=1.1.7 <1.3.2 depends on custom_lint_builder ^0.3.3 and riverpod_lint >=2.0.0 <2.0.1 depends on riverpod_analyzer_utils ^0.3.2, riverpod_lint <2.0.1 requires custom_lint_builder ^0.2.12 or
      >=0.3.2 <0.4.0 or riverpod_analyzer_utils ^0.0.1 or ^0.1.2 or >=0.3.1 <0.4.0.
    And because riverpod_lint >=2.0.1 depends on custom_lint_builder ^0.5.2 and custom_lint_builder >=0.0.13 <0.5.5 depends on hotreloader ^3.0.5, every version of riverpod_lint requires riverpod_analyzer_utils ^0.0.1 or
      ^0.1.2 or >=0.3.1 <0.4.0 or hotreloader ^3.0.5 or custom_lint_builder ^0.5.5.
(1) So, because custom_lint_builder >=0.5.5 depends on hotreloader >=3.0.5 <5.0.0 and riverpod_generator >=2.3.7 <3.0.0-dev.2 depends on riverpod_analyzer_utils ^0.5.0, if riverpod_generator >=2.3.7 <3.0.0-dev.2 and
      riverpod_lint any then hotreloader >=3.0.5 <5.0.0.

    Because hotreloader >=3.0.5 <3.0.6 depends on vm_service >=6.0.1 <10.0.0 and hotreloader >=3.0.6 <4.1.0 depends on vm_service >=6.0.1 <12.0.0, hotreloader >=3.0.5 <4.1.0 requires vm_service >=6.0.1 <12.0.0.
    And because hotreloader >=4.1.0 depends on vm_service >=6.0.1 <14.0.0, hotreloader >=3.0.5 requires vm_service >=6.0.1 <14.0.0.
    And because if riverpod_generator >=2.3.7 <3.0.0-dev.2 and riverpod_lint any then hotreloader >=3.0.5 <5.0.0 (1), if riverpod_generator >=2.3.7 <3.0.0-dev.2 and riverpod_lint any then vm_service >=6.0.1 <14.0.0.
    And because riverpod_test depends on flutter_test from sdk which depends on vm_service 14.0.0, riverpod_generator >=2.3.7 <3.0.0-dev.2 is incompatible with riverpod_lint.
    So, because riverpod_test depends on both riverpod_generator ^2.3.9 and riverpod_lint any, version solving failed.

To be able to install riverpod_lint , remove this:

  flutter:
    sdk: flutter

and you can now install flutter pub add dev:riverpod_lint

Expected behavior
Install Riverpod packages at the same time be compatible with flutter_test.

@rrousselGit
Copy link
Owner

Blocked by vegardit/dart-hotreloader#17

@rrousselGit
Copy link
Owner

That should be fixed by running dart pub upgrade.
Could you try?

@rrousselGit
Copy link
Owner

Actually it seems like hotreloader hasn't been published yet.

In the meantime, I'd suggest using:

dependency_overrides:
  vm_service: ^14.0.0

@hpelitebook745G2
Copy link
Author

thanks @rrousselGit ! the override works with both:

dev_dependencies:
  flutter_test:
    sdk: flutter
...
  riverpod_lint: ^2.3.7

i won't close this yet, so people newly integrating Riverpod could see this until hotreloader is published.

@rrousselGit
Copy link
Owner

Should be good to go now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants