Skip to content

Instantly share code, notes, and snippets.

@Alkimisti
Created August 16, 2020 20:16
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 Alkimisti/e9add9f6daae76c58a911d29bf417a77 to your computer and use it in GitHub Desktop.
Save Alkimisti/e9add9f6daae76c58a911d29bf417a77 to your computer and use it in GitHub Desktop.
Conversion int, String, double
// Conversions int <-> String, double <-> String
void main() {
// Convert String to double
var s = '12.95';
var d = double.parse(s);
print('${d.runtimeType} $d');
// Convert double to String
d = 12.95;
s = d.toString();
print('${s.runtimeType} $s');
// Convert String to int
s = '13';
var i = int.parse(s);
print('${i.runtimeType} $i');
// Convert int to String
i = 13;
s = i.toString();
print('${s.runtimeType} $s');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment