generate method

  1. @override
void generate(
  1. T generatorOptions,
  2. Root root,
  3. StringSink sink, {
  4. required String dartPackageName,
})
override

Generates files for specified language with specified generatorOptions

Implementation

@override
void generate(
  T generatorOptions,
  Root root,
  StringSink sink, {
  required String dartPackageName,
}) {
  final Indent indent = Indent(sink);

  writeFilePrologue(
    generatorOptions,
    root,
    indent,
    dartPackageName: dartPackageName,
  );

  writeFileImports(
    generatorOptions,
    root,
    indent,
    dartPackageName: dartPackageName,
  );

  writeOpenNamespace(
    generatorOptions,
    root,
    indent,
    dartPackageName: dartPackageName,
  );

  writeGeneralUtilities(
    generatorOptions,
    root,
    indent,
    dartPackageName: dartPackageName,
  );

  if (root.apis.any((Api api) => api is AstProxyApi)) {
    writeInstanceManager(
      generatorOptions,
      root,
      indent,
      dartPackageName: dartPackageName,
    );

    writeInstanceManagerApi(
      generatorOptions,
      root,
      indent,
      dartPackageName: dartPackageName,
    );

    writeProxyApiBaseCodec(generatorOptions, root, indent);
  }

  writeEnums(
    generatorOptions,
    root,
    indent,
    dartPackageName: dartPackageName,
  );

  writeDataClasses(
    generatorOptions,
    root,
    indent,
    dartPackageName: dartPackageName,
  );

  writeApis(
    generatorOptions,
    root,
    indent,
    dartPackageName: dartPackageName,
  );

  writeCloseNamespace(
    generatorOptions,
    root,
    indent,
    dartPackageName: dartPackageName,
  );
}