capitalize method

String capitalize()

Implementation

String capitalize() {
  if ((this ?? '').isEmpty) {
    return '';
  } else if ((this ?? '').length == 1) {
    return (this ?? '').toUpperCase();
  } else {
    return '${(this ?? '').substring(0, 1).toUpperCase()}${(this ?? '').substring(1).toLowerCase()}';
  }
}