RationalFormattingExtension extension

An extension on Rational to provide additional formatting functionality

on
  • Rational

Methods

toCurrencyString({String? locale, String? currencyName, int? decimalDigits}) String

Available on Rational, provided by the RationalFormattingExtension extension

Formats the rational number as a localized currency string
toDecimalString(int decimalPlaces, {RoundingMode mode = RoundingMode.halfUp, bool stripTrailingZeros = false, String? locale, String? pattern}) String

Available on Rational, provided by the RationalFormattingExtension extension

Formats the rational number as a localized decimal string with a specified number of decimal places, applying the given rounding mode
toPercentageString(int maxDecimals, {int minDecimals = 0, RoundingMode mode = RoundingMode.halfUp, String? locale, bool asRatio = true}) String

Available on Rational, provided by the RationalFormattingExtension extension

Formats the rational number as a percentage string, with a specified number of decimal places, applying the given rounding mode.