toTitleCase property

String toTitleCase

Converts all first characters in this string to capital case and rest to the lower case.

Implementation

String get toTitleCase => split(' ')
    .map(
      (String word) => word.isNotEmpty
          ? word[0].toUpperCase() + word.substring(1).toLowerCase()
          : '',
    )
    .join(' ');