toDoubleN static method
Converts a dynamic value to a nullable double.
d
- The dynamic value to be converted.
Returns a double if the conversion is successful, otherwise null.
Implementation
static double? toDoubleN(dynamic d) {
if (d is double) {
return d;
}
if (d is int) {
return d.toDouble();
}
if (d is String) {
return double.tryParse(d);
}
return null;
}