capitalize method

String capitalize()

Returns the string with the first letter capitalized.

Implementation

String capitalize() {
  if (isEmpty) return '';
  return this[0].toUpperCase() + substring(1);
}