对象框生成器有关问题的详细信息?

Objectbox Generator Detailed Info about Issues?

当我在 JSON 中生成 运行 objectbox_generator 和 flutter packages pub run build_runner watch 类 时,但不久之后由于以下原因生成失败空检查问题。我检查了我的代码,没有发现任何空检查问题。有没有办法显示更详细的日志(例如它所在的位置)?

[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

带有附加信息的相同命令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

从代码看来您有一个 @Backlink() 到一个未知实体(一个未存储在数据库中的实体)...尝试检查这些反向链接(并将它们注释掉以查看是否有效),当你发现哪个触发了这个,考虑在 objectbox-dart 的 GitHub 上用最小的例子打开一个问题。

P. S. 至于 null 检查失败 - 是的,需要一个更好的错误(一个告诉你丢失实体的错误) - https://github.com/objectbox/objectbox-dart/commit/00aabe224eaa9bb88ab2bc18a5c31f00b4f3bdc0