当我在 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