Skip to content

Instantly share code, notes, and snippets.

@LiewJunTung
Last active December 13, 2019 15:59
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 LiewJunTung/a1b37d34dca6240fd13d58d8e93b1ca2 to your computer and use it in GitHub Desktop.
Save LiewJunTung/a1b37d34dca6240fd13d58d8e93b1ca2 to your computer and use it in GitHub Desktop.
extension NumberParsing on String {
int parseInt() {
return int.parse(this);
}
double parseDouble() {
return double.parse(this);
}
}
void main(){
var numString = "100";
var numInt = numString.parseInt();
print(numInt is int);
var numDouble = numString.parseInt();
print(numDouble is double);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment