LibraryBuilder constructor
LibraryBuilder(})
Creates a builder that generates standalone Dart library files.
@param generator The generator to run @param formatOutput Function to format the generated code @param outputExtensions File extensions that this builder will create @param writeDescriptions Whether to include generator descriptions in comments @param header Optional header text for generated files @param allowSyntaxErrors Whether to process files with syntax errors @param options Additional configuration options
Implementation
LibraryBuilder(
Generator generator, {
super.formatOutput = _defaultFormatOutput,
required super.outputExtensions,
super.writeDescriptions,
super.header,
super.allowSyntaxErrors,
super.options,
}) : super(<Generator>[generator]) {
for (final String ext in outputExtensions) {
if (ext == SharedPartBuilder.extension) {
throw ArgumentError(
'The LibraryBuilder cannot be used with the shared part extension',
);
}
if (!ext.endsWith('.dart')) {
throw ArgumentError(
'LibraryBuilder output extensions must end with .dart',
);
}
}
}