toTitleCase method

String toTitleCase()

Capitalizes each word in the string. Example: "rayman 2: the great escape".toTitleCase() == "Rayman 2: The Great Escape"

Implementation

String toTitleCase() => replaceAllMapped(
    RegExp(r'\b\w+\b'), (match) => match.group(0)!.capitalize());