LengthRateFormat class
Allows a LengthRate to be formatted.
See UnitOfMeasurementFormat for general notes on the pattern syntax and LengthFormat for length-specific notes.
final lengthRate = 42.meters().per(const Duration(seconds: 1));
// '42 m/s'
final result1 = LengthRateFormat().format(lengthRate);
// '42 meters per second'
final result2 = LengthRateFormat(pattern: "0.## U 'per' R").format(lengthRate);
// '8,267.72 ft/min'
final result3 = LengthRateFormat(
pattern: "###,##0.## u:ft'/'r:min",
permissibleValueUnits: LengthUnits.imperial,
).format(lengthRate);
See also:
- Inheritance
-
- Object
- UnitOfMeasurementFormat<
LengthRate, LengthUnit> - LengthRateFormat
Constructors
-
LengthRateFormat.new({String pattern = "0.## ${UnitOfMeasurementFormat.valueUnitSymbolFormatSpecifier}'/'${UnitOfMeasurementFormat.rateUnitSymbolFormatSpecifier}", Set<
LengthUnit> permissibleValueUnits = LengthUnits.commonSi, 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<
LengthUnit> -
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
format(
LengthRate input) → String -
Formats
input
according to the pattern and locale of this format.inherited -
getLargestUnit(
LengthRate input) → LengthUnit -
Determines the largest denomination of unit in
input
that has a value of at least1
.override -
getPatternSpecifierFor(
LengthUnit 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< LengthUnit> -
Gets a set of permissible
TUnit
values.inherited -
getUnitName(
LengthUnit unit, String locale) → String -
Gets the a
unit
name in the givenlocale
.inherited -
getUnitQuantity(
LengthRate input, LengthUnit unit) → Decimal -
Determines how many units of
unit
theinput
contains, including any fractional portion.override -
getUnitSymbol(
LengthUnit 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
-
scaleToRateUnit(
LengthRate input, RateUnit rateUnit) → LengthRate -
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