titleCase property

String get titleCase

Capitalize first letter of each word

Implementation

String get titleCase {
  if (isEmpty) return this;
  return split(' ')
      .map((word) => word.isNotEmpty
          ? '${word[0].toUpperCase()}${word.substring(1).toLowerCase()}'
          : word)
      .join(' ');
}