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

Support source_gen 2 and analyzer 7 #705

Open
Shajk0 opened this issue Jan 21, 2025 · 8 comments
Open

Support source_gen 2 and analyzer 7 #705

Shajk0 opened this issue Jan 21, 2025 · 8 comments
Labels
enhancement New feature or request

Comments

@Shajk0
Copy link

Shajk0 commented Jan 21, 2025

Hey guys

I wanted to test objectbox, but I get a dependency error.
Seems like a too old version of source_gen is used and so I have a conflict with other packges.
Could you please update this to source_gen to version 2.0.0

Because no versions of objectbox_generator match >4.0.3 <5.0.0 and objectbox_generator 4.0.3 depends on source_gen ^1.0.0, objectbox_generator ^4.0.3 requires source_gen ^1.0.0.

Edit:
Found another conflict:
Because no versions of objectbox_generator match >4.0.3 <5.0.0 and objectbox_generator 4.0.3 depends on analyzer >=5.2.0 <7.0.0, objectbox_generator ^4.0.3 requires analyzer >=5.2.0 <7.0.0. And because riverpod_lint >=2.6.4 <3.0.0-dev.0 depends on analyzer ^7.0.0, objectbox_generator ^4.0.3 is incompatible with riverpod_lint >=2.6.4 <3.0.0-dev.0.

@Shajk0 Shajk0 added the bug Something isn't working label Jan 21, 2025
@greenrobot-team
Copy link
Member

greenrobot-team commented Jan 22, 2025

Thanks for reporting! We will test with the newer versions, make required changes and then allow them in pubspec.

As for the first message the relevant part is missing ("is incompatible with...") so I can't advice. But the solution is the same as for the second conflict:

Change your pubspec to allow the needed versions of the conflicting dependency, like for riverpod_lint allow lower than version 2.6.4. Then Flutter (or rather pub) will find versions that work together for you.

Edit: there is a chance that finding matching versions is impossible. In this case a dependency override to force a specific version can be a temporary solution.

For our reference, this is internal issue objectbox-dart#133.

@greenrobot-team greenrobot-team changed the title Dependency conflict - source_gen too old Support source_gen 2 and analyzer 7 Jan 22, 2025
@greenrobot-team greenrobot-team added enhancement New feature or request and removed bug Something isn't working labels Jan 22, 2025
@simeonApproppo
Copy link

I have the same issue when I try to used the actual version of freezed: (2.5.8)

And because objectbox_generator >=0.13.0+1 depends on source_gen ^1.0.0 and freezed >=2.5.8 <3.0.0-0.0.dev depends on source_gen ^2.0.0,
  freezed >=2.5.8 <3.0.0-0.0.dev is incompatible with objectbox_generator.

@greenrobot-team
Copy link
Member

@simeonApproppo If you are saying my recommendation to allow more versions does not work, I updated my comment above to include a workaround for that case.

@simeonApproppo
Copy link

Downgrading to freezed 2.5.7 is working.. But I hope that you will release a version, that depends on a actual version of source_gen soon. :-)

@mike-500
Copy link

mike-500 commented Feb 6, 2025

@greenrobot-team Using dependency overrides won't work as source_gen 3.0.0 introduces breaking changes (https://pub.dev/packages/source_gen/changelog).

@greenrobot-team
Copy link
Member

@mike-500 Thanks for the info! It also requires at least Dart 3.6. As we try to support as many old Dart (and Flutter) versions as possible, that is another thing to consider.

But as the first comment already has 6 thumbs ups I guess doing it soon is more important.

@azlekov
Copy link

azlekov commented Feb 18, 2025

Hello, objectbox cannot be used with latest versions of auto_route and not compatible with json_serializable:

Because objectbox_generator <0.13.0-nullsafety.0 doesn't support null safety and objectbox_generator >=0.13.0-nullsafety.0 <0.13.0+1 depends on source_gen ^0.9.0, objectbox_generator <0.13.0+1 requires source_gen ^0.9.0.
And because objectbox_generator >=0.13.0+1 depends on source_gen ^1.0.0, every version of objectbox_generator requires source_gen ^0.9.0 or ^1.0.0.
And because json_serializable 6.9.4 depends on source_gen ^2.0.0 and no versions of json_serializable match >6.9.4 <7.0.0, objectbox_generator is incompatible with json_serializable ^6.9.4.
So, because glue_app depends on both json_serializable ^6.9.4 and objectbox_generator any, version solving failed.

Overriding source_gen to ^2.0.0 leads to issue with dart_style used by auto_route_generator

@xdkomel
Copy link

xdkomel commented Feb 26, 2025

@azlekov AutoRoute downgrade to 9.0.0 works for me, and it's still the same major version. Didn't check the json_serializable though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants