toTitleCase method

String toTitleCase()

Capitalize first letter of all words in this string

Implementation

String toTitleCase() => replaceAll(RegExp(' +'), ' ')
    .split(' ')
    .map((str) => str.toCapitalized())
    .join(' ');