Convert String to Double in Dart
In this Dart language tutorial we learn how to convert a String value into double value in a Dart program.
How to convert String to double in Dart
To parse a String into double value we can use the double.parse() function as below.
double doubleValue = double.parse('12.34');
The following Dart example program to show you more detail how to use the double.parse() function to convert String to double.
void main() {
String stringValue = '65.78';
double doubleValue = double.parse(stringValue);
print('String value: ${stringValue}');
print('Double value: ${doubleValue}');
}
String value: 65.78
Double value: 65.78
Happy Coding 😊