toNum function
Converts value into a num.
If value is a String, it is parsed.
If value is a num or Int64, it is converted to a double.
Otherwise, null is returned.
Implementation
num? toNum(Object value) {
if (value is num) {
return value;
} else if (value is Int64) {
return value.toDouble();
} else if (value is String) {
return double.tryParse(value);
} else {
return null;
}
}