对于扩展HiveObject的类,生成运行程序生成失败。如果没有此扩展,生成将成功运行。这是解决方案的已知问题吗?
受影响的类之一:
@HiveType(typeId: 3)
@JsonSerializable()
class CustomerModel extends HiveObject{
@HiveField(0)
String? id;
@HiveField(1)
String? title;
...
使用--verbose生成输出:
flutter pub run build_runner build --verbose
[ +289 ms] executing: [C:\Users\\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +867 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] 85684f9300908116a78138ea4c6036c35c9a1236
[ +1 ms] executing: [C:\Users\\flutter/] git tag --points-at 85684f9300908116a78138ea4c6036c35c9a1236
[+1099 ms] Exit code 0 from: git tag --points-at 85684f9300908116a78138ea4c6036c35c9a1236
[ +18 ms] 3.0.4
[ +48 ms] executing: [C:\Users\\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[+1123 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [C:\Users\\flutter/] git ls-remote --get-url origin
[ +712 ms] Exit code 0 from: git ls-remote --get-url origin
[ +2 ms] https://github.com/flutter/flutter.git
[ +208 ms] Waiting to be able to obtain lock of Flutter binary artifacts directory: C:\Users\\flutter\bin\cache\lockfile
[ +22 ms] Waiting for another flutter command to release the startup lock...
[+7826 ms] executing: [C:\Users\\flutter/] git rev-parse --abbrev-ref HEAD
[ +545 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +1 ms] stable
[ +412 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +8 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +157 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[ ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'PubDependencies' is not required, skipping update.
[ +155 ms] Using C:\Users\\flutter\.pub-cache for the pub cache.
[ +1 ms] executing: C:\Users\\flutter\bin\cache\dart-sdk\bin\dart __deprecated_pub run build_runner build --verbose
[INFO] Entrypoint:Generating build script...
[INFO] Entrypoint:Generating build script completed, took 969ms
[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Reading cached asset graph...
[INFO] BuildDefinition:Reading cached asset graph completed, took 202ms
[INFO] BuildDefinition:Checking for updates since last build...
[INFO] BuildDefinition:Checking for updates since last build completed, took 1.5s
[INFO] Build:Running build...
[INFO] Heartbeat:1.2s elapsed, 5/12 actions completed.
[INFO] Heartbeat:2.4s elapsed, 5/12 actions completed.
[INFO] Heartbeat:3.6s elapsed, 5/12 actions completed.
[INFO] Heartbeat:4.7s elapsed, 5/12 actions completed.
[INFO] Heartbeat:19.4s elapsed, 5/12 actions completed.
[WARNING] Heartbeat:
No actions completed for 18.7s, waiting on:
- json_serializable:json_serializable on lib/data/forms/project_form.dart
- json_serializable:json_serializable on lib/data/selection/customer_object_selection.dart
- json_serializable:json_serializable on lib/data/forms/widgets/damage_card.dart
- json_serializable:json_serializable on lib/data/selection/customer_selector.dart
- json_serializable:json_serializable on lib/data/selection/insurance_agency_selection.dart
.. and 2 more
[FINE] json_serializable:json_serializable on lib/data/forms/project_form.dart:Running JsonSerializableGenerator - 1 of 2
[FINE] json_serializable:json_serializable on lib/data/forms/project_form.dart:Running JsonLiteralGenerator - 2 of 2
[FINE] json_serializable:json_serializable on lib/data/selection/customer_object_selection.dart:Running JsonSerializableGenerator - 1 of 2
[FINE] json_serializable:json_serializable on lib/data/selection/customer_object_selection.dart:Running JsonLiteralGenerator - 2 of 2
[FINE] json_serializable:json_serializable on lib/data/selection/customer_selector.dart:Running JsonSerializableGenerator - 1 of 2
[FINE] json_serializable:json_serializable on lib/data/selection/customer_selector.dart:Running JsonLiteralGenerator - 2 of 2
[FINE] json_serializable:json_serializable on lib/data/selection/insurance_agency_selection.dart:Running JsonSerializableGenerator - 1 of 2
[FINE] json_serializable:json_serializable on lib/data/selection/insurance_agency_selection.dart:Running JsonLiteralGenerator - 2 of 2
[FINE] json_serializable:json_serializable on lib/data/selection/insurance_selection.dart:Running JsonSerializableGenerator - 1 of 2
[FINE] json_serializable:json_serializable on lib/data/selection/insurance_selection.dart:Running JsonLiteralGenerator - 2 of 2
[FINE] json_serializable:json_serializable on lib/data/selection/expert_selector.dart:Running JsonSerializableGenerator - 1 of 2
[FINE] json_serializable:json_serializable on lib/data/selection/expert_selector.dart:Running JsonLiteralGenerator - 2 of 2
[FINE] json_serializable:json_serializable on lib/data/forms/widgets/damage_card.dart:Running JsonSerializableGenerator - 1 of 2
[FINE] json_serializable:json_serializable on lib/data/forms/widgets/damage_card.dart:Running JsonLiteralGenerator - 2 of 2
[INFO] Build:Running build completed, took 20.2s
[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 138ms
[SEVERE] json_serializable:json_serializable on lib/data/models/entities/project_model.dart (cached):
type 'MixinElementImpl' is not a subtype of type 'ClassElement' in type cast
package:json_serializable/src/field_helpers.dart 40:53 _FieldSet._sortByLocation
package:json_serializable/src/field_helpers.dart 36:37 _FieldSet.compareTo
dart:collection ListMixin.sort
package:json_serializable/src/field_helpers.dart 104:7 createSortedFieldSet
package:json_serializable/src/generator_helper.dart 54:26 GeneratorHelper.generate
dart:_internal WhereIterator.moveNext
package:json_serializable/src/json_part_builder.dart 64:27 _UnifiedGenerator.generate
package:source_gen/src/builder.dart 352:23 _generate
[SEVERE] json_serializable:json_serializable on lib/data/models/entities/expert_model.dart (cached):
type 'MixinElementImpl' is not a subtype of type 'ClassElement' in type cast
package:json_serializable/src/field_helpers.dart 40:53 _FieldSet._sortByLocation
package:json_serializable/src/field_helpers.dart 36:37 _FieldSet.compareTo
dart:collection ListMixin.sort
package:json_serializable/src/field_helpers.dart 104:7 createSortedFieldSet
package:json_serializable/src/generator_helper.dart 54:26 GeneratorHelper.generate
dart:_internal WhereIterator.moveNext
package:json_serializable/src/json_part_builder.dart 64:27 _UnifiedGenerator.generate
package:source_gen/src/builder.dart 352:23 _generate
[SEVERE] json_serializable:json_serializable on lib/data/models/entities/insurance_model.dart (cached):
type 'MixinElementImpl' is not a subtype of type 'ClassElement' in type cast
package:json_serializable/src/field_helpers.dart 40:53 _FieldSet._sortByLocation
package:json_serializable/src/field_helpers.dart 36:37 _FieldSet.compareTo
dart:collection ListMixin.sort
package:json_serializable/src/field_helpers.dart 104:7 createSortedFieldSet
package:json_serializable/src/generator_helper.dart 54:26 GeneratorHelper.generate
dart:_internal WhereIterator.moveNext
package:json_serializable/src/json_part_builder.dart 64:27 _UnifiedGenerator.generate
package:source_gen/src/builder.dart 352:23 _generate
[SEVERE] json_serializable:json_serializable on lib/data/models/entities/insurance_agency_model.dart (cached):
type 'MixinElementImpl' is not a subtype of type 'ClassElement' in type cast
package:json_serializable/src/field_helpers.dart 40:53 _FieldSet._sortByLocation
package:json_serializable/src/field_helpers.dart 36:37 _FieldSet.compareTo
dart:collection ListMixin.sort
package:json_serializable/src/field_helpers.dart 104:7 createSortedFieldSet
package:json_serializable/src/generator_helper.dart 54:26 GeneratorHelper.generate
dart:_internal WhereIterator.moveNext
package:json_serializable/src/json_part_builder.dart 64:27 _UnifiedGenerator.generate
package:source_gen/src/builder.dart 352:23 _generate
[SEVERE] json_serializable:json_serializable on lib/data/models/entities/customer_model.dart (cached):
type 'MixinElementImpl' is not a subtype of type 'ClassElement' in type cast
package:json_serializable/src/field_helpers.dart 40:53 _FieldSet._sortByLocation
package:json_serializable/src/field_helpers.dart 36:37 _FieldSet.compareTo
dart:collection ListMixin.sort
package:json_serializable/src/field_helpers.dart 104:7 createSortedFieldSet
package:json_serializable/src/generator_helper.dart 54:26 GeneratorHelper.generate
dart:_internal WhereIterator.moveNext
package:json_serializable/src/json_part_builder.dart 64:27 _UnifiedGenerator.generate
package:source_gen/src/builder.dart 352:23 _generate
[SEVERE] json_serializable:json_serializable on lib/data/models/entities/customer_object_model.dart (cached):
type 'MixinElementImpl' is not a subtype of type 'ClassElement' in type cast
package:json_serializable/src/field_helpers.dart 40:53 _FieldSet._sortByLocation
package:json_serializable/src/field_helpers.dart 36:37 _FieldSet.compareTo
dart:collection ListMixin.sort
package:json_serializable/src/field_helpers.dart 104:7 createSortedFieldSet
package:json_serializable/src/generator_helper.dart 54:26 GeneratorHelper.generate
dart:_internal WhereIterator.moveNext
package:json_serializable/src/json_part_builder.dart 64:27 _UnifiedGenerator.generate
package:source_gen/src/builder.dart 352:23 _generate
[SEVERE] Build:
Failed after 20.4s
[+28058 ms] "flutter run" took 28.446ms.
[ +12 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:416:7)
<asynchronous suspension>
#2 PackagesForwardCommand.runCommand (package:flutter_tools/src/commands/packages.dart:251:5)
<asynchronous suspension>
#3 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183: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:209:13)
<asynchronous suspension>
#6 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281: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:229: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:94:3)
<asynchronous suspension>
[ +100 ms] ensureAnalyticsSent: 90ms
[ +3 ms] Running shutdown hooks
[ +1 ms] Shutdown hooks complete
[ +1 ms] exiting with code 1
我可以提供更多的信息,如果需要找到一个解决这个问题。
谢谢你提前回答。
1条答案
按热度按时间vc6uscn91#
此问题已在v6.4.1中修复-只需获取最新版本https://pub.dev/packages/json_serializable/changelog#641