convertToDouble function
Converts a value
to a double type.
If the value
is of type int, it is converted to double. If the value
is
of type String, it is parsed to double using double.tryParse(). Otherwise,
the original value is returned as double.
Implementation
double convertToDouble(Object? value) {
if (value is int) {
return value + .0;
} else if (value is String) {
return double.tryParse(value) as double;
}
return value as double;
}