cast method
Casts the argument to this data type, otherwise throw an ArgumentError.
Implementation
@override
num cast(dynamic value) {
if (value is num) {
return value;
} else if (value is BigInt) {
return value.toInt();
} else if (value is Fraction) {
return value.toDouble();
} else if (value is String) {
return num.tryParse(value) ?? super.cast(value);
}
return super.cast(value);
}