convertToNumMap static method
Implementation
static Map<String, num> convertToNumMap(Map<String, dynamic> map) {
return Map.fromEntries(map.entries.map((entry) {
if (entry.value is int || entry.value is double) {
return MapEntry(entry.key, entry.value);
} else if (entry.value is String && num.tryParse(entry.value) != null) {
return MapEntry(entry.key, num.parse(entry.value));
} else {
throw Exception('Value for key ${entry.key} is not a number');
}
}));
}