Weight class
A unit of measurement representing a weight.
- Inheritance
-
- Object
- UnitOfMeasurement<
WeightUnit, Weight> - Weight
Constructors
- Weight.fromGigatonnes(Rational gigatonnes)
-
Creates a Weight representing the specified number of
gigatonnes
.factory - Weight.fromGrams(Rational grams)
-
Creates a Weight representing the specified number of
grams
.factory - Weight.fromImperialTons(Rational imperialTons)
-
Creates a Weight representing the specified number of
imperialTons
.factory - Weight.fromKilograms(Rational kilograms)
-
Creates a Weight representing the specified number of
kilograms
.factory - Weight.fromMegatonnes(Rational megatonnes)
-
Creates a Weight representing the specified number of
megatonnes
.factory - Weight.fromMicrograms(Rational micrograms)
-
Creates a Weight representing the specified number of
micrograms
.factory - Weight.fromMilligrams(Rational milligrams)
-
Creates a Weight representing the specified number of
milligrams
.factory - Weight.fromNanograms(Rational nanograms)
-
Creates a Weight representing the specified number of
nanograms
.factory - Weight.fromOunces(Rational ounces)
-
Creates a Weight representing the specified number of
ounces
.factory - Weight.fromPounds(Rational pounds)
-
Creates a Weight representing the specified number of
pounds
.factory - Weight.fromTonnes(Rational tonnes)
-
Creates a Weight representing the specified number of
tonnes
.factory - Weight.fromUnits(WeightUnit unit, Rational value)
-
Creates a Weight given a
unit
and rationalvalue
for that unit. - Weight.fromUsTons(Rational usTons)
-
Creates a Weight representing the specified number of
usTons
.factory
Properties
- baseValue ↔ Rational
-
The underlying base value of the unit of measurement.
latefinalinherited
- gigatonnes → Rational
-
Gets the number of gigatonnes in this Weight, including any fractional portion.
no setter
- grams → Rational
-
Gets the number of grams in this Weight, including any fractional portion.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- imperialTons → Rational
-
Gets the number of imperialTons in this Weight, including any fractional portion.
no setter
- kilograms → Rational
-
Gets the number of kilograms in this Weight, including any fractional portion.
no setter
- megatonnes → Rational
-
Gets the number of megatonnes in this Weight, including any fractional portion.
no setter
- micrograms → Rational
-
Gets the number of micrograms in this Weight, including any fractional portion.
no setter
- milligrams → Rational
-
Gets the number of milligrams in this Weight, including any fractional portion.
no setter
- nanograms → Rational
-
Gets the number of nanograms in this Weight, including any fractional portion.
no setter
- ounces → Rational
-
Gets the number of ounces in this Weight, including any fractional portion.
no setter
- pounds → Rational
-
Gets the number of pounds in this Weight, including any fractional portion.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tonnes → Rational
-
Gets the number of tonnes in this Weight, including any fractional portion.
no setter
- usTons → Rational
-
Gets the number of usTons in this Weight, including any fractional portion.
no setter
Methods
-
abs(
) → Weight -
Gets the absolute value.
inherited
-
compareTo(
Weight other) → int -
Compares this object to another object.
inherited
-
createValue(
Rational baseValue) → Weight -
Creates a unit of measurement value with the specified
baseValue
.override -
getBaseValue(
WeightUnit unit, Rational value) → Rational -
Gets the base value for a unit of measurement of
unit
andvalue
.override -
getLargestUnit(
{required Set< WeightUnit> permissibleUnits}) → WeightUnit -
Determines the largest unit that has a value of at least
1
.inherited -
getUnits(
WeightUnit unit) → Rational -
Gets the number of
unit
units in this unit of measurement.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
per(
Duration period) → WeightRate -
Creates a WeightRate with the specified
period
from this value. -
round(
WeightUnit roundTo) → Weight -
Rounds this unit of measurement such that the
roundTo
unit will be rounded towards the nearest integer.inherited -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator *(
Rational factor) → Weight -
Multiplies this value by
factor
.inherited -
operator +(
Weight other) → Weight -
Adds
other
onto this value.inherited -
operator -(
Weight other) → Weight -
Subtracts
other
from this value.inherited -
operator /(
Rational divisor) → Weight -
Divides this value by
divisor
.inherited -
operator <(
Weight other) → bool -
Determines whether this value is less than
other
.inherited -
operator <=(
Weight other) → bool -
Determines whether this value is less than or equal to
other
.inherited -
operator ==(
Object other) → bool -
Determines whether this unit of measurement value is equal to
other
.inherited -
operator >(
Weight other) → bool -
Determines whether this value is greater than
other
.inherited -
operator >=(
Weight other) → bool -
Determines whether this value is greater than or equal to
other
.inherited -
operator unary-(
) → Weight -
Negates this value.
inherited