toTitleCase method
Capitalizes the first letter of each word in the string.
Example:
'hello world'.toTitleCase(); // 'Hello World'
Implementation
String toTitleCase() => replaceAll(
RegExp(' +'),
' ',
).split(' ').map((str) => str.toSentenceCase()).join(' ');