toTitleCase property
String
get
toTitleCase
Capitalizes the first letter of each whitespace-delimited word.
Implementation
String get toTitleCase => trim()
.split(RegExp(r'\s+'))
.where((w) => w.isNotEmpty)
.map((w) => w.toSentenceCase)
.join(' ');