PartBuilder class Null safety

A Builder which generates part of files.

This builder should be avoided - prefer using SharedPartBuilder and generating content that can be merged with output from other builders into a common .g.dart part file.

Each output should correspond to a part directive in the primary input, this will be validated.

Content output by each generator is concatenated and written to the output. A part of directive will automatically be included in the output and should not need be written by any of the generators.

Available Extensions


PartBuilder(List<Generator> generators, String generatedExtension, {String formatOutput(String code)?, List<String> additionalOutputExtensions = const [], String? header, bool allowSyntaxErrors = false})
Wrap generators as a Builder that generates part of files. [...]


allowSyntaxErrors bool
Whether to allow syntax errors in input libraries.
final, inherited
buildExtensions Map<String, List<String>>
Mapping from input file extension to output file extensions. [...]
final, inherited
formatOutput String Function(String)
Function that determines how the generated code is formatted.
final, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


build(BuildStep buildStep) Future
Generates the outputs for a given BuildStep.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]