toDouble static method
Converts a value to a double.
Example: '3.14' -> 3.14
Implementation
static double toDouble(Object? value) {
if (value is String) {
return double.tryParse(value) ?? 0.0;
} else if (value is int) {
return value.toDouble();
} else if (value is double) {
return value;
} else {
return 0.0;
}
}