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