generate function

Future<String> generate(
  1. LibraryReader library,
  2. BuildStep buildStep,
  3. CompilerFlags flags
)

Given an input library a.dart, returns the code for a.template.dart.

Implementation

Future<String> generate(
  LibraryReader library,
  BuildStep buildStep,
  CompilerFlags flags,
) {
  // Read the library and determine the outputs of `*.template.dart`.
  return processTemplates(library.element, buildStep, flags).then((outputs) {
    // Writes the output to disk (as a text file).
    return buildGeneratedCode(
      library.element,
      outputs,
      fileName(buildStep.inputId),
      flags,
    );
  });
}