titleCase static method
Capitalizes the first letter of each word.
Implementation
static String titleCase(String text) {
if (text.isEmpty) return text;
return text.trim().split(RegExp(r'\s+')).map((String word) {
if (word.isEmpty) return word;
return word[0].toUpperCase() + word.substring(1).toLowerCase();
}).join(' ');
}