capitalize method

String capitalize()

Implementation

String capitalize() {
  if (this.isEmpty) return this;

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