toFixed method

String toFixed({
  1. int? decimalPlaces,
  2. NumberFormat? format,
  3. RoundingMode rounding = RoundingMode.roundDown,
})

Implementation

String toFixed({
  int? decimalPlaces,
  NumberFormat? format,
  RoundingMode rounding = RoundingMode.roundDown,
}) {
  final decimal = decimalPlaces ?? currency.decimals;
  assert(decimal <= currency.decimals, 'DECIMALS');
  final fraction = super.tryParseFraction(decimalScale);

  return super
      .divide(fraction)
      .toFixedNative(decimal, format: format, rounding: rounding);
}