titleCase property

String get titleCase

Converts the string to title case.

Example:

'hello world'.titleCase; // 'Hello World'

Implementation

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