Mass class
A mass Measurement - for example 55.67 grams.
To create a new Mass
object, use any of this class's factory
constructors.
For example,
Mass heightOfEverest = Mass.fromKilograms(8.848);
Use one of the properties, such as inGrams, to retrieve the double value
of the Mass
in the specified mass unit.
For example,
Mass heightOfEverest = Mass.fromKilograms(8.848);
assert(heightOfEverest.inGrams == 8848.0);
This class provides a collection of arithmetic and comparison operators.
See Measurement for the collection of arithmetic and comparison operators which this class provides.
- Inheritance
- Object
- Measurement<
Mass> - Mass
Constructors
- Mass.fromGrams(double grams)
-
Returns a new
Mass
object from the number of grams.const - Mass.fromImperialTonnes(double usTonnes)
-
Returns a new
Mass
object from the number of Imperial Tonnes.const - Mass.fromKilograms(double kilograms)
-
Returns a new
Mass
object from the number of kilograms.const - Mass.fromMetricTonnes(double tonnes)
-
Returns a new
Mass
object from the number of tonnes.const - Mass.fromMicrograms(double micrograms)
-
Returns a new
Mass
object from the number of micrograms.const - Mass.fromMilligrams(double milligrams)
-
Returns a new
Mass
object from the number of milligrams.const - Mass.fromNanograms(double nanograms)
-
Returns a new
Mass
object from the number of nanograms.const - Mass.fromOunces(double ounces)
-
Returns a new
Mass
object from the number of feet.const - Mass.fromPounds(double pounds)
-
Returns a new
Mass
object from the number of pounds.const - Mass.fromStones(double stones)
-
Returns a new
Mass
object from the number of stones.const - Mass.fromUSTonnes(double usTonnes)
-
Returns a new
Mass
object from the number of US Tonnes.const
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- inGrams → double
-
Returns the total number of grams making up this
Mass
.read-only - inImperialTonnes → double
-
Returns the total number of US tonnes making up this
Mass
.read-only - inKilograms → double
-
Returns the total number of kilograms making up this
Mass
.read-only - inMetricTonnes → double
-
Returns the total number of metric tonnes making up this
Mass
.read-only - inMicrograms → double
-
Returns the total number of micrograms making up this
Mass
.read-only - inMilligrams → double
-
Returns the total number of milligrams making up this
Mass
.read-only - inNanograms → double
-
Returns the total number of nanograms making up this
Mass
.read-only - inOunces → double
-
Returns the total number of feet making up this
Mass
.read-only - inPounds → double
-
Returns the total number of pounds making up this
Mass
.read-only - inStones → double
-
Returns the total number of stones making up this
Mass
.read-only - inUSTonnes → double
-
Returns the total number of US tonnes making up this
Mass
.read-only - isNegative → bool
-
Returns whether this
Measurement
is negative.read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
abs(
) → Mass -
Returns a new object of
T
representing the absolute value of thisMeasurement
. [...]inherited -
compareTo(
Mass other) → int -
Compares this
Measurement
toother
, returning zero if the values are equal. [...]inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator *(
double other) → Mass -
Multiples this
Measurement
byother
and returns the result as a new object ofT
.inherited -
operator +(
Mass other) → Mass -
Adds this
Measurement
andother
and returns the sum as a new object ofT
.inherited -
operator -(
Mass other) → Mass -
Subtracts
other
from thisMeasurement
and returns the difference as a new object ofT
.inherited -
operator /(
double other) → Mass -
Divides this
Measurement
byother
and returns the result as a new object ofT
.inherited -
operator <(
Mass other) → bool -
Returns
true
if the value of thisMeasurement
is less than the value ofother
.inherited -
operator <=(
Mass other) → bool -
Returns
true
if the value of thisMeasurement
is less than or equal to the value ofother
.inherited -
operator ==(
dynamic other) → bool -
Returns
true
if this Measurement has the same value asother
.inherited -
operator >(
Mass other) → bool -
Returns
true
if the value of thisMeasurement
is greater than the value ofother
.inherited -
operator >=(
Mass other) → bool -
Returns
true
if the value of thisMeasurement
is greater than or equal to the value ofother
.inherited -
operator unary-(
) → Mass -
Returns a new object of
T
representing thisMeasurement
negated. [...]inherited