operator == method
Returns true if this Quantity is equal to obj
. Two Quantity
objects are considered equal if their MKS values and dimensions are equal.
Only values and dimensions are considered; other attributes such as
uncertainty and preferred units are ignored.
Scalar quantities are also considered equal to num and Number objects with matching values.
Implementation
@override
bool operator ==(Object obj) {
if (this is Scalar && (obj is num || obj is Number)) return valueSI == obj;
if (obj is Quantity) {
if (!(dimensions == obj.dimensions)) return false;
return compareTo(obj) == 0;
}
return false;
}