titleCase method
Implementation
String titleCase() {
if (this == null || this!.isEmpty) return '';
return this!
.split(' ')
.map(
(word) =>
word.isEmpty ? '' : word[0].toUpperCase() + word.substring(1),
)
.join(' ');
}