Temperature class
Represents a quantity of temperature.
Temperature conversions are affine (involve offsets) and are handled by specific formulas within the getValue method, rather than simple multiplicative factors.
- Inheritance
-
- Object
- Quantity<
TemperatureUnit> - Temperature
- Available extensions
- Annotations
-
- @immutable
Constructors
- Temperature(double _value, TemperatureUnit _unit)
-
Creates a new Temperature quantity with the given value and unit.
const
Properties
- asCelsius → Temperature
-
Available on Temperature, provided by the TemperatureValueGetters extension
Returns a Temperature representing this temperature in Celsius (°C).no setter - asDelta → TemperatureDelta
-
Available on Temperature, provided by the TemperatureValueGetters extension
Converts this absolute temperature into a TemperatureDelta relative to absolute zero.no setter - asFahrenheit → Temperature
-
Available on Temperature, provided by the TemperatureValueGetters extension
Returns a Temperature representing this temperature in Fahrenheit (°F).no setter - asKelvin → Temperature
-
Available on Temperature, provided by the TemperatureValueGetters extension
Returns a Temperature representing this temperature in Kelvin (K).no setter - asRankine → Temperature
-
Available on Temperature, provided by the TemperatureValueGetters extension
Returns a Temperature representing this temperature in Rankine (°R).no setter - hashCode → int
-
Returns a hash code for this
Quantityinstance.no setterinherited - inCelsius → double
-
Available on Temperature, provided by the TemperatureValueGetters extension
Returns the temperature value in Celsius (°C).no setter - inFahrenheit → double
-
Available on Temperature, provided by the TemperatureValueGetters extension
Returns the temperature value in Fahrenheit (°F).no setter - inKelvin → double
-
Available on Temperature, provided by the TemperatureValueGetters extension
Returns the temperature value in Kelvin (K).no setter - inRankine → double
-
Available on Temperature, provided by the TemperatureValueGetters extension
Returns the temperature value in Rankine (°R).no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unit → TemperatureUnit
-
Returns the unit of measurement associated with this quantity's original value.
no setterinherited
- value → double
-
Returns the numerical value of this quantity in its original unit.
no setterinherited
Methods
-
compareTo(
Quantity< TemperatureUnit> other) → int -
Compares this Temperature object to another Quantity<TemperatureUnit>.
override
-
convertTo(
TemperatureUnit targetUnit) → Temperature -
Creates a new Temperature instance with the value converted to the
targetUnit.override -
getValue(
TemperatureUnit targetUnit) → double -
Converts this temperature's value to the specified
targetUnitusing direct, optimized formulas for affine conversions.override -
isEquivalentTo(
Quantity< TemperatureUnit> other) → bool -
Checks if this quantity has the same physical magnitude as another.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
ratioTo(
Temperature other) → double -
Computes the thermodynamically valid ratio of this temperature to
other. -
subtract(
TemperatureDelta delta) → Temperature - Subtracts a TemperatureDelta from this temperature, returning a new Temperature in the same unit. Models cooling.
-
toString(
{TemperatureUnit? targetUnit, int? fractionDigits, bool showUnitSymbol = true, String unitSymbolSeparator = '\u00A0', String? locale, NumberFormat? numberFormat}) → String -
Returns a string representation of this quantity, with options for
formatting and unit conversion.
inherited
Operators
-
operator +(
TemperatureDelta delta) → Temperature - Adds a TemperatureDelta to this temperature, returning a new Temperature in the same unit.
-
operator -(
Temperature other) → TemperatureDelta - Subtracts another Temperature from this, yielding a TemperatureDelta.
-
operator <(
Quantity< TemperatureUnit> other) → bool -
Checks if this quantity's magnitude is less than another's.
inherited
-
operator <=(
Quantity< TemperatureUnit> other) → bool -
Checks if this quantity's magnitude is less than or equal to another's.
inherited
-
operator ==(
Object other) → bool -
Determines whether this Quantity is equal to another Object.
inherited
-
operator >(
Quantity< TemperatureUnit> other) → bool -
Checks if this quantity's magnitude is greater than another's.
inherited
-
operator >=(
Quantity< TemperatureUnit> other) → bool -
Checks if this quantity's magnitude is greater than or equal to another's.
inherited
Constants
- fahrenheitOffset → const double
- The offset for Fahrenheit conversion from Celsius (0°C = 32°F).
- fahrenheitScaleFactor → const double
- The scaling factor for Fahrenheit to Celsius conversion (9/5).
- kelvinOffsetFromCelsius → const double
- The offset of Kelvin from Celsius (0°C = 273.15K).
- rankineOffsetFromFahrenheit → const double
- The offset for Rankine conversion from Fahrenheit (0°F = 459.67°R).