added function to format enum value names
This commit is contained in:
6
lib/services/tools.dart
Normal file
6
lib/services/tools.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
String getEnumValueName<T extends Enum>(T value) {
|
||||
String name =
|
||||
value.name.replaceAllMapped(RegExp(r'[A-Z]'), (match) => ' ${match[0]}');
|
||||
name = name[0].toUpperCase() + name.substring(1);
|
||||
return name;
|
||||
}
|
||||
Reference in New Issue
Block a user