Unit class abstract

A determinate Quantity (as of length, time, heat, or value) adopted as a standard of measurement.

It is helpful to think of instances of this class as recording the history by which they are created. Thus, for example, the string "g/kg" (which is a dimensionless unit) would result from invoking the method toString() on a unit that was created by dividing a gram unit by a kilogram unit. Yet, "kg" divided by "kg" returns one and not "kg/kg" due to automatic unit factorization.

This class supports the multiplication of offsets units. The result is usually a unit not convertible to its {@link #getStandardUnit standard unit}. Such units may appear in derivative quantities. For example °C/m is an unit of gradient, which is common in atmospheric and oceanographic research.

Units raised at rational powers are also supported. For example the cubic root of "liter" is a unit compatible with meter.

Implementers

Constructors

Unit()
const
Unit.inverseOf(Unit a)
factory
Unit.productOf(Unit a, Unit b)
factory
Unit.quotient(Unit a, Unit b)
factory

Properties

dimension Dimension
The dimension of this unit.
no setter
hashCode int
The hash code for this object.
no setterinherited
isStandardUnit bool
Indicates if this unit is a standard unit.
no setter
quantity Quantity
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
standardUnit Unit
//////////////////////////////////////////////// //////////////////////////////////////////////// The BaseUnit base unit, AlternateUnit alternate unit or product of base units and alternate units this unit is derived from.
no setter

Methods

divide(Unit that) Unit
The quotient of this unit with the one specified.
getConverterTo(Unit that) UnitConverter
Returns a converter of numeric values from this unit to another unit.
inverse() Unit
The inverse of this unit.
isCompatible(Unit that) bool
Indicates if this unit is compatible with the unit specified.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
plus(num offset) Unit
The result of adding an offset to this unit.
pow(RationalNumber pow) Unit
scaled(num factor, [num divisor = 1]) Unit
The result of multiplying this unit by a factor.
times(Unit that) Unit
The product of this unit with the one specified.
toStandardUnit() UnitConverter
Returns the converter from this unit to its standard unit.
toString() String
A string representation of this object.
override
transform(UnitConverter operation) Unit
Returns the unit derived from this unit using the specified converter.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

one → const Unit