writeLibraryDefinitionToBuffer function

void writeLibraryDefinitionToBuffer(
  1. StringBuffer buffer,
  2. List<String> ignoreForFile,
  3. LibraryDefinition definition
)

Generate Dart code typings from a query or mutation and its response from a QueryDefinition into a buffer.

Implementation

void writeLibraryDefinitionToBuffer(
  StringBuffer buffer,
  List<String> ignoreForFile,
  LibraryDefinition definition,
) {
  buffer.writeln('// GENERATED CODE - DO NOT MODIFY BY HAND');
  if (ignoreForFile.isNotEmpty) {
    buffer.writeln(
      '// ignore_for_file: ${Set<String>.from(ignoreForFile).join(', ')}',
    );
  }
  buffer.write('\n');
  buffer.write(specToString(generateLibrarySpec(definition)));
}