generateFields method

String generateFields(
  1. Map<String, dynamic> fields
)

Produce instance fields

Implementation

String generateFields(Map<String, dynamic> fields) {
  final keys = fields.keys.toList()..sort();
  return keys.fold<List<String>>(<String>[], (acc, key) {
    final valueType = fields[key].runtimeType.toString();
    return acc..add('  final $valueType ${toCamelCase(key)};');
  }).join('\n\n');
}