Quantity class

A unit of measurement representing a dimensionless quantity (a.k.a. "bare", "pure", or "scalar" quantity). This means it is a quantity that has no corresponding physical dimension associated with it.

Inheritance
Available Extensions

Constructors

Quantity.fromBillions(Rational billions)
Creates a Quantity representing the specified number of billions.
factory
Quantity.fromMillions(Rational millions)
Creates a Quantity representing the specified number of millions.
factory
Quantity.fromOnes(Rational ones)
Creates a Quantity representing the specified number of ones.
factory
Quantity.fromThousands(Rational thousands)
Creates a Quantity representing the specified number of thousands.
factory
Quantity.fromTrillions(Rational trillions)
Creates a Quantity representing the specified number of trillions.
factory
Quantity.fromUnits(QuantityUnit unit, Rational value)
Creates a Quantity given a unit and rational value for that unit.

Properties

baseValue ↔ Rational
The underlying base value of the unit of measurement.
latefinalinherited
billions → Rational
Gets the number of billions in this Quantity, including any fractional portion.
no setter
hashCode int
The hash code for this object.
no setterinherited
millions → Rational
Gets the number of millions in this Quantity, including any fractional portion.
no setter
ones → Rational
Gets the number of ones in this Quantity, including any fractional portion.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
thousands → Rational
Gets the number of thousands in this Quantity, including any fractional portion.
no setter
trillions → Rational
Gets the number of trillions in this Quantity, including any fractional portion.
no setter

Methods

abs() Quantity
Gets the absolute value.
inherited
compareTo(Quantity other) int
Compares this object to another object.
inherited
createValue(Rational baseValue) Quantity
Creates a unit of measurement value with the specified baseValue.
override
getBaseValue(QuantityUnit unit, Rational value) → Rational
Gets the base value for a unit of measurement of unit and value.
override
getLargestUnit({required Set<QuantityUnit> permissibleUnits}) QuantityUnit
Determines the largest unit that has a value of at least 1.
inherited
getUnits(QuantityUnit 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) QuantityRate
Creates a QuantityRate with the specified period from this value.
round(QuantityUnit roundTo) Quantity
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) Quantity
Multiplies this value by factor.
inherited
operator +(Quantity other) Quantity
Adds other onto this value.
inherited
operator -(Quantity other) Quantity
Subtracts other from this value.
inherited
operator /(Rational divisor) Quantity
Divides this value by divisor.
inherited
operator <(Quantity other) bool
Determines whether this value is less than other.
inherited
operator <=(Quantity 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 >(Quantity other) bool
Determines whether this value is greater than other.
inherited
operator >=(Quantity other) bool
Determines whether this value is greater than or equal to other.
inherited
operator unary-() Quantity
Negates this value.
inherited

Static Properties

zero Quantity
A Quantity of zero.
final