DerivedUnit class

A Unit derived from some combination of other units.

Inheritance

Constructors

DerivedUnit({required String symbol, required String singular, required String plural, required Dimensions dimensions, required num scale, bool spaceBeforeSymbol = true})
const

Properties

dimensions Dimensions
The dimensions of the unit, e.g. length, time, mass.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
plural String
The plural name of the unit, e.g. "metres", "seconds".
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
safePlural String
The plural name of the unit, wrapped in square brackets if it is not a NamedUnit.
no setterinherited
safeSingular String
The singular name of the unit, wrapped in square brackets if it is not a NamedUnit.
no setterinherited
safeSymbol String
The symbol of the unit, wrapped in square brackets if it is not a NamedUnit.
no setterinherited
scale num
The ratio of the unit to the base unit in SI-MKS.
finalinherited
singular String
The singular name of the unit, e.g. "metre", "second".
finalinherited
spaceBeforeSymbol bool
Whether to put a space before the symbol when displaying it.
finalinherited
symbol String
The symbol of the unit, e.g. "m" for metre, "s" for second.
finalinherited
symbolForQuantity String
The symbol of the unit, or an empty string if the unit is the dimensionless unit "one".
no setterinherited
symbolWithSpace String
The symbol of the unit, potentially prepended with a space based on spaceBeforeSymbol.
no setterinherited

Methods

cubed() DerivedUnit
A cubed DerivedUnit copy of this unit.
inherited
inverse() Unit
An inverted copy of this unit, inverting both the dimensions and scale.
inherited
named({required String symbol, required String singular, required String plural, bool? spaceBeforeSymbol}) NamedUnit
Creates a copy of this DerivedUnit as a NamedUnit with the given symbol, singular and plural names.
nameForValue(num value) String
The appropriate name of the unit for the given value, either singular or plural.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
squared() DerivedUnit
A squared DerivedUnit copy of this unit.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator *(Unit other) Unit
Multiplies this unit by other, creating a new DerivedUnit.
inherited
operator /(Unit other) Unit
Divides this unit by other, creating a new DerivedUnit.
inherited
operator ==(Object other) bool
Whether this unit is equal to other, having the same scale and dimensions.
inherited
operator ^(num exponent) Unit
Raises this unit to the power of exponent, creating a new DerivedUnit.
inherited