toCapitalCase property

String toCapitalCase

Converts all characters in this string to capital case.

Implementation

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