Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dart Extensions methods example 2
void main() {
final String _text = 'ExTEnSiON';
print(_text.capitalize()); //Extension
}
extension StringExtensions on String {
String capitalize() {
return "${this[0].toUpperCase()}${this.toLowerCase().substring(1)}";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment