writeClassEncode method
void
writeClassEncode(
- KotlinOptions generatorOptions,
- Root root,
- Indent indent,
- Class classDefinition, {
- required String dartPackageName,
override
Writes a single class encode method to indent
.
Implementation
@override
void writeClassEncode(
KotlinOptions generatorOptions,
Root root,
Indent indent,
Class classDefinition, {
required String dartPackageName,
}) {
indent.write('fun toList(): List<Any?> ');
indent.addScoped('{', '}', () {
indent.write('return listOf');
indent.addScoped('(', ')', () {
for (final NamedType field
in getFieldsInSerializationOrder(classDefinition)) {
final String fieldName = field.name;
indent.writeln('$fieldName,');
}
});
});
}