String val = "1.8";
double result = double.parse(val);
print(result);
// -> 1.8
The method double.parse(value) takes the value as a required parameter and returns the value in double type format.
In the code snippet, we have defined a string format variable named val that needs to be converted to a double type format. We are using double.parse(val) to convert this string variable to double.
0 Comments