capitalize method
Returns the string with the first letter capitalized.
print('flutter'.capitalize()) // Flutter
print('Flutter'.capitalize()) // Flutter
Implementation
String capitalize() {
switch (length) {
case 0:
return this;
case 1:
return toUpperCase();
default:
return substring(0, 1).toUpperCase() + substring(1);
}
}