objectbox / objectbox-dart

Flutter database for super-fast Dart object persistence
https://docs.objectbox.io/getting-started
Apache License 2.0
1.05k stars 120 forks source link

Example file is not running event management tutorial ---> many-to-many #687

Open venkat9507 opened 1 month ago

venkat9507 commented 1 month ago

Cannot build runner for event management tutorial many-to-many

user@user-Mac-mini many_to_many % fvm dart pub run build_runner build Deprecated. Use dart run instead. [INFO] Generating build script completed, took 172ms [INFO] Reading cached asset graph completed, took 171ms [INFO] Checking for updates since last build completed, took 656ms [WARNING] objectbox_generator:resolver on lib/main.dart: Your current analyzer version may not fully support your current SDK version.

Analyzer language version: 3.2.0 SDK language version: 3.5.0

Please update to the latest analyzer version (6.11.0) by running flutter packages upgrade.

If you are not getting the latest version by running the above command, you can try adding a constraint like the following to your pubspec to start diagnosing why you can't get the latest version:

dev_dependencies: analyzer: ^6.11.0

[SEVERE] objectbox_generator:generator on lib/$lib$:

Unknown relation backlink source for 'Owner.tasks' [INFO] Running build completed, took 7.3s [INFO] Caching finalized dependency graph completed, took 147ms [SEVERE] Failed after 7.4s

ERROR:

[SEVERE] objectbox_generator:generator on lib/$lib$: Unknown relation backlink source for 'Owner.tasks'

I will try to solve this and give PR

greenrobot-team commented 1 month ago

Thanks for reporting, I could reproduce this!

A workaround for this it to modify the ToMany in the Owner class to explicitly specify the Backlink source:

  @Backlink('owner')
  final tasks = ToMany<Task>();

As there is only one matching source relation, the generator should be able to choose the right one. So this might be a bug in the generator. We should investigate.

(Internal issue objectbox/objectbox-dart#125)

venkat9507 commented 3 weeks ago

thank you for reproducing it