Last active
November 23, 2020 00:34
-
-
Save samuelematias/b42cb6cc7c269f7a5cca8be0928159ea to your computer and use it in GitHub Desktop.
Dart Extensions methods example 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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