Dart Type Conversion
Convert with int.parse, double.parse, toString, toInt and toDouble. tryParse returns null instead of throwing.
Example
int a = int.parse("42");
double b = double.parse("2.5");
print(a + b);
print(int.tryParse("abc"));
print(7.9.toInt());Exercise
Safe parse.
int.("x")
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.