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