TemperatureRateFormat class

Allows a TemperatureRate to be formatted.

See UnitOfMeasurementFormat for general notes on the pattern syntax and TemperatureFormat for temperature-specific notes.

final temperatureRate = 42.kelvins().per(const Duration(minutes: 1));

// '2246.85°C/hr'
final result1 = TemperatureRateFormat().format(temperatureRate);

// '2246.85 Celsius per hour'
final result2 = TemperatureRateFormat(pattern: "0.## U 'per' R").format(temperatureRate);

// '42,000,000 μK/min'
final result3 = TemperatureRateFormat(
  pattern: "###,##0.## u:μK'/'r:min",
  permissibleValueUnits: TemperatureUnits.kelvin,
).format(temperatureRate);

See also:

Inheritance

Constructors

TemperatureRateFormat({String pattern = "0.##${UnitOfMeasurementFormat.valueUnitSymbolFormatSpecifier}'/'${UnitOfMeasurementFormat.rateUnitSymbolFormatSpecifier}", Set<TemperatureUnit> permissibleValueUnits = TemperatureUnits.celsius, Set<RateUnit> permissibleRateUnits = RateUnits.hourOrLess, String? locale})

Properties

hashCode int
The hash code for this object.
no setterinherited
locale String?
The locale to use when formatting values.
finalinherited
pattern String
The pattern that indicates the desired output when formatting input values.
finalinherited
permissibleRateUnits Set<RateUnit>
finalinherited
permissibleValueUnits Set<TemperatureUnit>
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

format(TemperatureRate input) String
Formats input according to the pattern and locale of this format.
inherited
getLargestUnit(TemperatureRate input) TemperatureUnit
Determines the largest denomination of unit in input that has a value of at least 1.
override
getPatternSpecifierFor(TemperatureUnit valueUnit) String
Gets the pattern specifier for the given value unit.
inherited
getPermissibleRateUnits() Set<RateUnit>
Gets a set of permissible RateUnit values.
inherited
getPermissibleValueUnits() Set<TemperatureUnit>
Gets a set of permissible TUnit values.
inherited
getUnitName(TemperatureUnit unit, String locale) String
Gets the a unit name in the given locale.
inherited
getUnitQuantity(TemperatureRate input, TemperatureUnit unit) → Rational
Determines how many units of unit the input contains, including any fractional portion.
override
getUnitSymbol(TemperatureUnit unit, String locale) String
Gets the a unit symbol in the given locale.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pluralizeValueUnits(String locale) bool
Determines whether value units should be pluralized. Defaults to true.
inherited
scaleToRateUnit(TemperatureRate input, RateUnit rateUnit) TemperatureRate
Scales input, which is assumed to be a rated unit of measurement, so that its rate is rateUnit.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited