Created
December 1, 2019 15:52
-
-
Save ibhavikmakwana/0e4d41ccfca3d898fd61c36d3f5bd740 to your computer and use it in GitHub Desktop.
String Extension Method
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() { | |
print('someString'.firstLetterToUpperCase()); | |
} | |
extension StringExtension on String{ | |
get firstLetterToUpperCase { | |
if (this != null) | |
return this[0].toUpperCase() + this.substring(1); | |
else | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment