capitalize method
Capitalizes the first letter of the given value
,
and converts the rest of the string to lowercase.
Example:
"hello".capitalize(); // "Hello"
Implementation
String capitalize() {
if (isEmpty) {
return this;
}
return '${this[0].toUpperCase()}${substring(1).toLowerCase()}';
}