PartBuilder constructor

PartBuilder(
  1. List<Generator> generators,
  2. String generatedExtension, {
  3. String formatOutput(
    1. String code
    )?,
  4. List<String> additionalOutputExtensions = const [],
  5. String? header,
  6. bool allowSyntaxErrors = false,
  7. BuilderOptions? options,
})

Wrap generators as a Builder that generates part of files.

generatedExtension indicates what files will be created for each .dart input. The generatedExtension should not be .g.dart. If you wish to produce .g.dart files please use SharedPartBuilder.

If any generator in generators will create additional outputs through the BuildStep they should be indicated in additionalOutputExtensions.

formatOutput is called to format the generated code. Defaults to DartFormatter.format.

header is used to specify the content at the top of each generated file. If null, the content of defaultFileHeader is used. If header is an empty String no header is added.

allowSyntaxErrors indicates whether to allow syntax errors in input libraries.

If available, the build_extensions option will be extracted from options to allow output files to be generated into a different directory

Implementation

PartBuilder(
  super.generators,
  String generatedExtension, {
  super.formatOutput,
  super.additionalOutputExtensions,
  super.header,
  super.allowSyntaxErrors,
  super.options,
}) : super(
        generatedExtension: generatedExtension,
      );