toNum method
Converts a value
to num.
Implementation
num? toNum(T value) {
if (value == null) return null;
if (value is num) {
return value;
} else {
try {
return parseNum(value);
} catch (e) {
throw StateError("Can't convert type to number: $value");
}
}
}