Unit<D extends Dimension> class
Represents a unit of measure.
Constructors
- Unit(D dim, String symbol, {String? name, UnitConverter? converter})
Properties
- converter → UnitConverter
-
Converter from this unit to the reference unit of its dimension.
final
- dim → D
-
Dimension represented by this unit.
final
- hashCode → int
-
Hash based on dimension and converter value.
no setteroverride
- hasScale ↔ bool
-
Whether this unit has an additive offset in its converter.
getter/setter pair
-
inverted
↔ Unit<
Dimension> -
Inverse unit.
getter/setter pair
- isBase ↔ bool
-
Whether this is the reference unit of its dimension.
getter/setter pair
- name ↔ String
-
Human-readable unit name.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- symbol ↔ String
-
Symbol used to render this unit.
getter/setter pair
- value ↔ num
-
Value of
1expressed in the reference unit.getter/setter pair
Methods
-
add(
num value) → Unit< D> -
Returns a new unit with
valueadded to its converter. -
cast<
T extends Dimension> (T dim) → Unit< T> -
Casts this unit to
dim. -
change(
Prefix from, Prefix to) → Unit< D> -
Replaces prefix
fromwithto. -
converterTo(
Unit< Dimension> other) → UnitConverter -
Returns a converter from this unit to
other. -
divide(
num value) → Unit< D> -
Returns a new unit divided by
value. -
group(
Prefix prefix) → Unit< D> - Returns a prefixed version of this unit.
-
isCompatible(
Unit< D> other) → bool -
Whether this unit is compatible with
other. -
multiply(
num value) → Unit< D> -
Returns a new unit scaled by
value. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
of(
D dim) → bool -
Whether this unit belongs to
dim. -
pow(
int p) → Unit< Dimension> -
Returns this unit raised to
p. -
rename(
{String? symbol, String? name}) → Unit< D> - Renames this unit and returns the same instance.
-
toMeasure(
num val) → Measure< D> -
Creates a measure with
valin this unit. -
toString(
) → String -
Returns symbol.
override
-
ungroup(
Prefix prefix) → Unit< D> -
Removes
prefixfrom this unit. -
valueTo(
num val, Unit< D> other) → num -
Converts
valfrom this unit toother.
Operators
-
operator *(
Unit< Dimension> other) → Unit<Dimension> -
operator +(
num other) → Unit< D> -
operator -(
num other) → Unit< D> -
operator /(
Unit< Dimension> other) → Unit<Dimension> -
operator ==(
Object other) → bool -
The equality operator.
override