checked method
Ensures that other has the same dimensions as this origin's quantity.
Implementation
Quantity checked(Quantity other) {
if (other.dimensions != dimensions) {
throw DimensionsException.mismatch(
expected: dimensions,
expectedUnits: unit,
actual: other.dimensions,
actualUnits: other.unit,
);
}
return other;
}