NumberFormatOptions.unit constructor

NumberFormatOptions.unit({
  1. required Unit unit,
  2. UnitDisplay unitDisplay = UnitDisplay.short,
  3. LocaleMatcher localeMatcher = LocaleMatcher.bestfit,
  4. SignDisplay signDisplay = SignDisplay.auto,
  5. Notation notation = const StandardNotation(),
  6. Grouping useGrouping = Grouping.auto,
  7. String? numberingSystem,
  8. RoundingMode roundingMode = RoundingMode.halfExpand,
  9. TrailingZeroDisplay trailingZeroDisplay = TrailingZeroDisplay.auto,
  10. int minimumIntegerDigits = 1,
  11. Digits? digits,
})

Implementation

factory NumberFormatOptions.unit({
  required Unit unit,
  UnitDisplay unitDisplay = UnitDisplay.short,
  //General options
  LocaleMatcher localeMatcher = LocaleMatcher.bestfit,
  SignDisplay signDisplay = SignDisplay.auto,
  Notation notation = const StandardNotation(),
  Grouping useGrouping = Grouping.auto,
  String? numberingSystem,
  RoundingMode roundingMode = RoundingMode.halfExpand,
  TrailingZeroDisplay trailingZeroDisplay = TrailingZeroDisplay.auto,
  int minimumIntegerDigits = 1,
  Digits? digits,
}) {
  return NumberFormatOptions.custom(
    style: UnitStyle(
      unit: unit,
      unitDisplay: unitDisplay,
    ),
    localeMatcher: localeMatcher,
    signDisplay: signDisplay,
    notation: notation,
    useGrouping: useGrouping,
    numberingSystem: numberingSystem,
    roundingMode: roundingMode,
    trailingZeroDisplay: trailingZeroDisplay,
    minimumIntegerDigits: minimumIntegerDigits,
    digits: digits,
  );
}