capitalize method

String capitalize()

Capitalizes first letter of string.

Implementation

String capitalize() {
  if (this == null || this!.isEmpty) return '';
  if (this!.length == 1) return this!.toUpperCase();
  return '${this![0].toUpperCase()}${this!.substring(1).toLowerCase()}';
}