Dimensions class

Representation of the nature of a physical quantity, defined as a map of base Dimension to their exponents.

All Dimensions immutable and can be used as compile-time constants.

For example, velocity has dimensions of length divided by time, or length: +1, time: -1. A scalar (dimensionless) quantity has no dimensions and is represented by an empty map.

Dimensions support natural arithmetic operations including multiplication, division, and exponentiation. Thus new Dimensions objects can be created by combining existing ones e.g. acceleration = length / (time ^ 2).

Constructors

Dimensions(Map<Dimension, num> map)
Constructs a Dimensions object with a map of base dimension to exponents.
Dimensions.constant(Map<Dimension, num> map)
Constructs a constant Dimensions object with a map of base dimensions to exponents.
const
Dimensions.empty()
const

Properties

hashCode int
The hash code for this object.
no setteroverride
isScalar bool
Whether or not these are scalar dimensions, including having no angle or solid angle dimensions.
no setter
isScalarSI bool
Whether or not these are scalar dimensions, in the strict International System of Units (SI) sense, which allows non-zero angle and solid angle dimensions.
no setter
map Map<Dimension, num>
The dimensions map (base dimension key -> base dimension exponent) as an unmodifiable view.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

checked(Quantity quantity) Quantity
Ensures that the dimensions of quantity match these dimensions.
equals(Dimensions other) bool
Test whether the dimensions of this object are equal to the dimensions of other.
equalsSI(Dimensions other) bool
Test whether the dimensions of this object are equal to the dimensions of other, only considering the seven base SI quantities (that is, angle and solid angle components are ignored).
inverse() Dimensions
An inverted copy of this object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A dimensional formula representation of these dimensions.
override

Operators

operator *(Dimensions other) Dimensions
Multiplies this object by other, creating a new Dimensions object.
operator /(Dimensions other) Dimensions
Divides this object by other, creating a new Dimensions object.
operator ==(Object other) bool
Test whether the dimensions of this object are equal to the dimensions of other.
override
operator [](Dimension dimension) num
The exponent for the given base dimension, or 0 if not present.
operator ^(num exp) Dimensions
Raises this object to the power of exp, creating a new Dimensions object.