toTemplateString method
Implementation
String toTemplateString() {
return '''
enum $enumName { ${values.map((e) => valueName(e)).toList().join(', ')} }
extension ${enumName}Ex on $enumName{
$valueType? get value => $enumValuesMapName.reverse[this];
}
final $enumValuesMapName = $converterName({
${valuesForTemplate()}
});
class $converterName<$valueType, O> {
final Map<$valueType, O> map;
Map<O, $valueType>? reverseMap;
$converterName(this.map);
Map<O, $valueType> get reverse => reverseMap ??= map.map((k, v) => MapEntry(v, k));
}
''';
}