build method

  1. @override
FutureOr<void> build(
  1. BuildStep buildStep
)

Generates the outputs for a given BuildStep.

Implementation

@override
FutureOr<void> build(BuildStep buildStep) async {
  final lib = await buildStep.resolver
      .libraryFor(buildStep.inputId, allowSyntaxErrors: false);

  final infoGenerator = InfoGenerator(builderOptions);
  final data = await infoGenerator.generate(LibraryReader(lib), buildStep);
  if (data == null) {
    return;
  }
  await buildStep.writeAsString(buildStep.allowedOutputs.single, data);
}