From f98fabf5792bc8bb45b1c8da4abbb46e93875f54 Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 11 Feb 2025 14:41:34 +0100 Subject: [PATCH] added function to format enum value names --- lib/services/tools.dart | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 lib/services/tools.dart diff --git a/lib/services/tools.dart b/lib/services/tools.dart new file mode 100644 index 0000000..91ffde2 --- /dev/null +++ b/lib/services/tools.dart @@ -0,0 +1,6 @@ +String getEnumValueName(T value) { + String name = + value.name.replaceAllMapped(RegExp(r'[A-Z]'), (match) => ' ${match[0]}'); + name = name[0].toUpperCase() + name.substring(1); + return name; +}