TimeRateFormat class
Allows a TimeRate to be formatted.
See UnitOfMeasurementFormat for general notes on the pattern syntax and TimeFormat for time-specific notes.
final timeRate = 42.seconds().per(const Duration(minutes: 1));
// '42s/min'
final result1 = TimeRateFormat().format(timeRate);
// '42 seconds per minute'
final result2 = TimeRateFormat(pattern: "0.## U 'per' R").format(timeRate);
// '700,000 μs/s'
final result3 = TimeRateFormat(
pattern: "###,##0.## u:μs'/'r:s",
permissibleValueUnits: TimeUnits.all,
).format(timeRate);
See also:
- Inheritance
-
- Object
- UnitOfMeasurementFormat<
TimeRate, TimeUnit> - TimeRateFormat
Constructors
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<
TimeUnit> -
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
format(
TimeRate input) → String -
Formats
input
according to the pattern and locale of this format.inherited -
getLargestUnit(
TimeRate input) → TimeUnit -
Determines the largest denomination of unit in
input
that has a value of at least1
.override -
getPatternSpecifierFor(
TimeUnit 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< TimeUnit> -
Gets a set of permissible
TUnit
values.inherited -
getUnitName(
TimeUnit unit, String locale) → String -
Gets the a
unit
name in the givenlocale
.inherited -
getUnitQuantity(
TimeRate input, TimeUnit unit) → Rational -
Determines how many units of
unit
theinput
contains, including any fractional portion.override -
getUnitSymbol(
TimeUnit unit, String locale) → String -
Gets the a
unit
symbol in the givenlocale
.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(
TimeRate input, RateUnit rateUnit) → TimeRate -
Scales
input
, which is assumed to be a rated unit of measurement, so that its rate israteUnit
.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited