Objectbox Generator Detailed Info about Issues?

962 views Asked by At

When I run the objectbox_generator with flutter packages pub run build_runner watch the classes are being generated in the JSON, but shortly after that the Generation fails due to a null check issue. I checked my code and couldn't find any null check issues. Is there a way to show more detailed logs (e.g. where it is located) ?

[INFO] Starting Build

[INFO] Updating asset graph...
[INFO] Updating asset graph completed, took 0ms

[INFO] Running build...
[INFO] 1.0s elapsed, 14/20 actions completed.
[INFO] 2.1s elapsed, 38/54 actions completed.
[INFO] Running build completed, took 2.4s

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 100ms

// Here the failing info

[SEVERE] objectbox_generator:generator on lib/$lib$ (cached):

Null check operator used on a null value

[SEVERE] Failed after 2.5s

Same command with additional info flutter packages pub run build_runner build --verbose:

[INFO] Build:Running build...
[INFO] objectbox_generator:generator on lib/$lib$:Package: fit_x
[INFO] objectbox_generator:generator on lib/$lib$:Found 15 entities in: (lib/domain/ob/collection_exercise.objectbox.info, lib/domain/ob/equipment.objectbox.info, lib/domain/ob/equipment_setting.objectbox.info, ..., lib/domain/ob/workout_collection.objectbox.info, lib/domain/ob/workout_log.objectbox.info)
[INFO] objectbox_generator:generator on lib/$lib$:Using model: lib/objectbox-model.json
[SEVERE] objectbox_generator:generator on lib/$lib$:

Null check operator used on a null value
package:objectbox_generator/src/code_chunks.dart 444:38  CodeChunks.backlinkRelInfo
package:objectbox_generator/src/code_chunks.dart 488:18  CodeChunks.toManyRelations.<fn>
dart:_internal                                           ListIterable.join
package:objectbox_generator/src/code_chunks.dart 489:12  CodeChunks.toManyRelations
package:objectbox_generator/src/code_chunks.dart 134:46  CodeChunks.entityBinding
package:objectbox_generator/src/code_chunks.dart 32:71   CodeChunks.objectboxDart.<fn>
package:collection/src/iterable_extensions.dart 173:20   IterableExtension.mapIndexed
dart:core                                                Iterable.join
package:objectbox_generator/src/code_chunks.dart 32:99   CodeChunks.objectboxDart
package:objectbox_generator/src/code_builder.dart 97:27  CodeBuilder.updateCode
package:objectbox_generator/src/code_builder.dart 57:5   CodeBuilder.build

[INFO] Build:Running build completed, took 349ms

[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 117ms

[SEVERE] Build:
Failed after 476ms
[+3823 ms] "flutter run" took 3.927ms.
[   +5 ms] pub finished with exit code 1
[   +2 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _DefaultPub.interactively (package:flutter_tools/src/dart/pub.dart:366:7)
           <asynchronous suspension>
           #2      PackagesForwardCommand.runCommand (package:flutter_tools/src/commands/packages.dart:241:5)
           <asynchronous suspension>
           #3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
           <asynchronous suspension>
           #4      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #5      CommandRunner.runCommand (package:args/command_runner.dart:196:13)
           <asynchronous suspension>
           #6      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)    
           <asynchronous suspension>
           #7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #8      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
           <asynchronous suspension>
           #9      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #11     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>


[  +74 ms] ensureAnalyticsSent: 67ms
[   +1 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1
1

There are 1 answers

1
vaind On BEST ANSWER

From the code it looks like you have a @Backlink() to an unknown entity (one that is not stored in the DB)... try to check those backlinks (and comment them out to see if that works) and when you've found which one triggers this, consider opening an issue on objectbox-dart's GitHub with the minimal example.

P. S. as for the null check failure - yeah, needs a better error (one that tells you about the missing entity) - https://github.com/objectbox/objectbox-dart/commit/00aabe224eaa9bb88ab2bc18a5c31f00b4f3bdc0