capitalized property
String
get
capitalized
Capitalizes only the first letter of the string.
Returns a new string with the first character capitalized and the rest unchanged.
Example:
String name = 'hello';
name = name.capitalized; // 'Hello'
String title = 'HELLO WORLD';
title = title.capitalized; // 'HELLO WORLD' (only first letter)
Implementation
String get capitalized {
if (isEmpty) return this;
return this[0].toUpperCase() + substring(1);
}