writeDataClass method

  1. @override
void writeDataClass(
  1. ObjcOptions generatorOptions,
  2. Root root,
  3. Indent indent,
  4. Class klass, {
  5. required String dartPackageName,
})
override

Writes a single data class to indent.

Implementation

@override
void writeDataClass(
  ObjcOptions generatorOptions,
  Root root,
  Indent indent,
  Class klass, {
  required String dartPackageName,
}) {
  final Set<String> customClassNames =
      root.classes.map((Class x) => x.name).toSet();
  final Set<String> customEnumNames =
      root.enums.map((Enum x) => x.name).toSet();
  final String className = _className(generatorOptions.prefix, klass.name);

  indent.writeln('@implementation $className');
  _writeObjcSourceClassInitializer(generatorOptions, root, indent, klass,
      customClassNames, customEnumNames, className);
  writeClassDecode(
    generatorOptions,
    root,
    indent,
    klass,
    customClassNames,
    customEnumNames,
    dartPackageName: dartPackageName,
  );
  writeClassEncode(
    generatorOptions,
    root,
    indent,
    klass,
    customClassNames,
    customEnumNames,
    dartPackageName: dartPackageName,
  );
  indent.writeln('@end');
  indent.newln();
}