writeLibraryDefinitionToBuffer function
void
writeLibraryDefinitionToBuffer(
- StringBuffer buffer,
- List<
String> ignoreForFile, - LibraryDefinition definition,
- GeneratorOptions options,
Generate Dart code typings from a query or mutation and its response from a QueryDefinition into a buffer.
The output is intentionally emitted as-is (no dart_style post-processing)
so that the generated file looks like a plain, freezed-style generated
artifact. Consumers should rely on the header comments below to skip lints
and coverage for the file rather than on a specific whitespace layout.
Implementation
void writeLibraryDefinitionToBuffer(
StringBuffer buffer,
List<String> ignoreForFile,
LibraryDefinition definition,
GeneratorOptions options,
) {
buffer
..writeln('// GENERATED CODE - DO NOT MODIFY BY HAND')
..writeln('// coverage:ignore-file')
..writeln('// ignore_for_file: type=lint')
..writeln('// ignore_for_file: $_defaultIgnoreForFile');
if (ignoreForFile.isNotEmpty) {
buffer.writeln(
'// ignore_for_file: ${Set<String>.from(ignoreForFile).join(', ')}',
);
}
buffer
..write('\n')
..writeln('// dart format off')
..write(specToString(generateLibrarySpec(definition, options)));
}