label property
String
get
label
Returns a human-readable label from the enum case name.
Example: pendingPayment -> Pending Payment.
Implementation
String get label {
if (name.isEmpty) return '';
final words = name.replaceAllMapped(
RegExp(r'([a-z0-9])([A-Z])'),
(match) => '${match.group(1)} ${match.group(2)}',
);
return '${words[0].toUpperCase()}${words.substring(1)}';
}