generateConstructor method
Implementation
String generateConstructor(String name, Iterable<Field> fields) {
final result = StringBuffer();
result.writeln(' $name({');
for (final field in fields) {
if (!field.type.isOptional) {
result.writeln(' required this.${field.name},');
} else {
result.writeln(' this.${field.name},');
}
}
result.writeln(' });');
return result.toString();
}