capitalize method

String capitalize()

Returns a string with the first character in upper case.

Implementation

String capitalize() {
  if (this == null) {
    throw ArgumentError('string: $this');
  }
  if (this!.isEmpty) {
    return '';
  }
  return '${this![0].toUpperCase()}${this?.substring(1)}';
}