operator * method
Implementation
ValidatedQuantity operator *(Object other) {
if (other is UcumDecimal) {
return ValidatedQuantity.fromPair(
UcumService().multiply(this, ValidatedQuantity(value: other)));
} else if (other is ValidatedQuantity) {
return ValidatedQuantity.fromPair(UcumService().multiply(this, other));
} else if (other is num || other is BigInt) {
return ValidatedQuantity.fromPair(UcumService().multiply(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().multiply(this, newQuantity));
} else {
throw UcumException('$this could not be mulitplied with $other '
'(reason: it is not an accepted type)');
}
} else {
throw UcumException('$this could not be mulitplied with $other '
'(reason: it is not an accepted type)');
}
}