writeDataClass method
void
writeDataClass(
- SwiftOptions generatorOptions,
- Root root,
- Indent indent,
- Class classDefinition, {
- required String dartPackageName,
override
Writes a single data class to indent
.
Implementation
@override
void writeDataClass(
SwiftOptions generatorOptions,
Root root,
Indent indent,
Class classDefinition, {
required String dartPackageName,
}) {
final List<String> generatedComments = <String>[
' Generated class from Pigeon that represents data sent in messages.'
];
if (classDefinition.isSealed) {
generatedComments.add(
' This protocol should not be extended by any user class outside of the generated file.');
}
indent.newln();
addDocumentationComments(
indent, classDefinition.documentationComments, _docCommentSpec,
generatorComments: generatedComments);
_writeDataClassSignature(indent, classDefinition);
indent.writeScoped('', '}', () {
if (classDefinition.isSealed) {
return;
}
indent.newln();
writeClassDecode(
generatorOptions,
root,
indent,
classDefinition,
dartPackageName: dartPackageName,
);
writeClassEncode(
generatorOptions,
root,
indent,
classDefinition,
dartPackageName: dartPackageName,
);
});
}