Mass class

Represents an amount of mass.

Inheritance

Constructors

Mass.infinite()
Infinite mass.
const
Mass.negativeInfinite()
Infinite negative mass.
const
Mass.ofCentigrams(num centigrams, {Precision precision = Precision.max})
Mass.ofDecigrams(num decigrams, {Precision precision = Precision.max})
Mass.ofDekagrams(num dekagrams, {Precision precision = Precision.max})
Mass.ofGrams(num grams, {Precision precision = Precision.max})
Mass.ofHectograms(num hectograms, {Precision precision = Precision.max})
Mass.ofImperial({num pounds = 0, num ounces = 0, Precision precision = Precision.max})
Mass.ofKilograms(num kilograms, {Precision precision = Precision.max})
Mass.ofLongTons(num longTons, {Precision precision = Precision.max})
Mass.ofMetric({num milligrams = 0, num centigrams = 0, num decigrams = 0, num grams = 0, num dekagrams = 0, num hectograms = 0, num kilograms = 0, Precision precision = Precision.max})
Mass.ofMilligrams(num milligrams, {Precision precision = Precision.max})
Mass.ofOunces(num ounces, {Precision precision = Precision.max})
Mass.ofPounds(num pounds, {Precision precision = Precision.max})
Mass.ofShortTons(num shortTons, {Precision precision = Precision.max})
Mass.ofTonnes(num tonnes, {Precision precision = Precision.max})
Mass.sum(Iterable<Mass> parts, {Precision precision = Precision.max})
Constructs a Mass representing the sum of any number of other Masses.
Mass.zero()
Zero mass.
const

Properties

asCentigrams double
no setter
asDecigrams double
no setter
asDekagrams double
no setter
asGrams double
no setter
asHectograms double
no setter
asKilograms double
no setter
asLongTons double
no setter
asMilligrams double
no setter
asOunces double
no setter
asPounds double
no setter
asShortTons double
no setter
asTonnes double
no setter
hashCode int
The hash code for this object.
no setterinherited
isFinite bool
Returns true if this measurement is finite.
no setterinherited
isInfinite bool
Returns true if this measurement is infinite (either positive or negative).
no setterinherited
isNaN bool
Returns true if this measurement cannot be expressed as a number.
no setterinherited
isNegative bool
Returns true if this measurement is negative.
no setterinherited
precision int
Returns the number of digits of precision this measurement has.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
si double
The SI value this measurement is based on.
finalinherited

Methods

acceptVisitor(MeasurementVisitor visitor) → void
Accept a visitor object for double-dispatch.
override
as(MassInterpreter interpreter) double
Interprets this using the specified units.
compareMagnitude(Mass other) double
Returns the difference in magnitude between this and another measurement.
inherited
compareTo(Mass other) int
Compares this object to another object.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
withPrecision(Precision precision) Mass
Creates an equivalent measurement with the specified precision.
inherited

Operators

operator *(double multiplier) Mass
Returns a measurement equivalent to a multiple of this.
inherited
operator +(Mass other) Mass
Returns a measurement equivalent to the sum of two others.
inherited
operator -(Mass other) Mass
Returns a measurement equivalent to the difference between two others.
inherited
operator /(double divisor) Mass
Returns a measurement equivalent to a fraction of this.
inherited
operator <(Mass other) bool
Returns true if this is less than the other measurement.
inherited
operator <=(Mass other) bool
Returns true if this is less than or equal to the other measurement.
inherited
operator ==(dynamic other) bool
The equality operator.
inherited
operator >(Mass other) bool
Returns true if this is greater than the other measurement.
inherited
operator >=(Mass other) bool
Returns true if this is greater than or equal to the other measurement.
inherited
operator unary-() Mass
Returns a measurement representing the opposite of this.
inherited
operator ~/(Mass other) int
Returns the truncating division result of this and another measurement.
inherited