Skip to content

Instantly share code, notes, and snippets.

@samuelematias
Last active November 23, 2020 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelematias/b42cb6cc7c269f7a5cca8be0928159ea to your computer and use it in GitHub Desktop.
Save samuelematias/b42cb6cc7c269f7a5cca8be0928159ea to your computer and use it in GitHub Desktop.
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