build method

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

Generates the outputs for a given BuildStep.

Implementation

@override
Future<void> build(BuildStep buildStep) async {
  final resolver = buildStep.resolver;

  if (!await resolver.isLibrary(buildStep.inputId)) return;

  if (_generators.every((g) => g is GeneratorForAnnotation) &&
      !(await _hasAnyTopLevelAnnotations(
        buildStep.inputId,
        resolver,
        buildStep,
      ))) {
    return;
  }

  final lib = await buildStep.resolver
      .libraryFor(buildStep.inputId, allowSyntaxErrors: allowSyntaxErrors);
  await _generateForLibrary(lib, buildStep);
}