operator / method
Implementation
ValidatedQuantity operator /(Object other) {
if (other is UcumDecimal) {
return ValidatedQuantity.fromPair(
UcumService().divideBy(this, ValidatedQuantity(value: other)));
} else if (other is ValidatedQuantity) {
return ValidatedQuantity.fromPair(UcumService().divideBy(this, other));
} else if (other is num || other is BigInt) {
return ValidatedQuantity.fromPair(UcumService().divideBy(this,
ValidatedQuantity(value: UcumDecimal.fromString(other.toString()))));
} else if (other is String) {
final ValidatedQuantity newQuantity = ValidatedQuantity.fromString(other);
if (newQuantity.isValid()) {
return ValidatedQuantity.fromPair(
UcumService().divideBy(this, newQuantity));
} else {
throw UcumException('$this could not be dvided by $other '
'(reason: it is not an accepted type)');
}
} else {
throw UcumException('$this could not be divided by $other '
'(reason: it is not an accepted type)');
}
}