convertToDouble function
Implementation
double convertToDouble(dynamic json) {
if (json is num) {
return json.toDouble();
}
if (json is String) {
return double.parse(json);
}
throw FormatException('Value cannot be converted to double: $json');
}