generateDartClasses function

StringBuffer generateDartClasses(
  1. List<Objects> schemaTypes, {
  2. DartGeneratorOptions options = const DartGeneratorOptions(),
})

Generates Dart code for the given schema types.

The generated code is written to the buffer provided in the argument, or a new one is created if not provided, and then returned.

Implementation

StringBuffer generateDartClasses(List<Objects> schemaTypes,
    {DartGeneratorOptions options = const DartGeneratorOptions()}) {
  final writer = StringBuffer();
  final generatorExtras = <GeneratorExtras>[];
  for (final type in schemaTypes) {
    writer.writeObjects(type, generatorExtras, options);
  }
  if (generatorExtras.isNotEmpty) {
    return writer.withExtras(generatorExtras);
  }
  return writer;
}