I have made a SharedPartBuilder
that generates new class annotated with @JsonSerializable()
. How can I configure json_serializable
to run over .part
file generated by my builder before all .part
files are combined into one .g.dart
?
Inside build.yaml
, I have tried adding to my builder
runs_before: ["json_serializable"]
and
applies_builders: ["json_serializable"]
or
applies_builders: ["source_gen|combining_builder", "json_serializable"]
all without success.
EDIT: It seems this is not possible when using SharedPartBuilder
.
No
SharedPartBuilder
will be able to resolve the Dart code emitted by anotherSharedPartBuilder
. In order for emitted code to be used with theResolver
by later build steps, it must write to a.dart
file directly, and should be a different file extension than.g.dart
.https://github.com/dart-lang/build/blob/master/docs/builder_author_faq.md