parseNum static method
Tries to parse a num.
- Returns
def
ifvalue
is invalid.
Implementation
static num? parseNum(Object? value, [num? def]) {
if (value == null) return def;
if (value is num) {
return value;
} else if (value is DateTime) {
return value.millisecondsSinceEpoch;
} else {
var n = _parseNumString(value);
return n ?? def;
}
}