capitalize property

String capitalize

Capitalizes the first letter of the string. Returns the original string if it is empty.

Example:

print('hello'.capitalize); // Output: 'Hello'

Implementation

String get capitalize => isNotEmpty ? '${this[0].toUpperCase()}${substring(1)}' : '';