equivalent method

bool equivalent(
  1. Object other
)

Implementation

bool equivalent(Object other) {
  if (other is ValidatedQuantity) {
    return UcumService().isEqual(this, other);
  } else if (other is String) {
    final ValidatedQuantity newQuantity = ValidatedQuantity.fromString(other);
    if (newQuantity.isValid()) {
      return UcumService().isEqual(this, newQuantity);
    } else {
      return false;
    }
  } else if (other is num || other is BigInt) {
    final ValidatedQuantity newQuantity =
        ValidatedQuantity.fromString(other.toString());
    if (newQuantity.isValid()) {
      return UcumService().isEqual(this, newQuantity);
    } else {
      return false;
    }
  } else {
    return false;
  }
}