toTitleCase property

String get toTitleCase

Converts the string to Title Case. Example: "hello_world" => "Hello World"

Implementation

String get toTitleCase => toWords
    .map(
      (word) => word.shouldIgnoreCapitalization
          ? word.toLowerCase()
          : word.capitalizeFirstLowerRest,
    )
    .join(' ');