Quantity<K extends PhysicalProperty<K>> class

Quantity to portray the amount of Physical Quantity, defined as a combination o magnitude and unit.

Expressed as some amount of a unit. Defines math operations for quantities.

Implemented types

Constructors

Quantity({required double amount, required Unit<K> unit})
const

Properties

amount double
final
hashCode int
The hash code for this object.
no setterinherited
negated Quantity<K>
Returns a new Quantity with the same unit and this amount negated
no setter
props List<Object>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
unit Unit<K>
final
zero Quantity<K>
Returns a new Quantity with the same unit and zero amount
no setter

Methods

compareTo(Quantity<PhysicalProperty> other) int
Compares this object to another object.
override
convertTo(Unit<K> anotherUnit) Quantity<K>
Returns a new Quantity converted to another unit.
equivalent(Quantity<K> qtd) bool
Check if two quantities are equivalent when converted to the same unit.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
print({bool useName = false, int? fractionDigits}) String
toString() String
A string representation of this object.

Operators

operator *(double factor) Quantity<K>
Returns a new Quantity with the same unit and my amount multiplied by a factor
operator +(Quantity<K> qtd) Quantity<K>
Returns a new Quantity with the receiver's unit and the other quantity converted and added
operator -(Quantity<K> qtd) Quantity<K>
Returns a new Quantity with the receiver's unit and the other quantity converted and subtraccted
operator /(double factor) Quantity<K>
Returns a new Quantity with the same unit and my amount divided by a factor
operator ==(Object other) bool
The equality operator.
inherited