attributeToSource function
Converts a field attribute back into schema source.
Implementation
String attributeToSource(FieldAttribute attribute) {
if (attribute.arguments.isEmpty) {
return '@${attribute.name}';
}
final arguments = attribute.arguments.entries
.map((entry) {
if (entry.key == 'value') {
return entry.value;
}
return '${entry.key}: ${entry.value}';
})
.join(', ');
return '@${attribute.name}($arguments)';
}