generateEnumClassBody method
Generate data class from CustomType.
{@category generator}
Implementation
String generateEnumClassBody(SquintGeneratorOptions options) {
if (values.length != valuesJSON.length) {
throw SquintException(
"Failed to generate enum class because values and valuesJSON are not of equal size.",
);
}
var hasJsonValues = false;
var index = 0;
while (index < values.length) {
if (values[index] != valuesJSON[index]) {
hasJsonValues = true;
}
index += 1;
}
// todo add option to squintGen to configure how to format enum fields
// camelcase, pascalcase
final copied = copyWith(values: values);
return hasJsonValues
? copied._enumWithAnnotations(options)
: copied._enumWithoutAnnotations(options);
}