ExchangeRate.fromMinorUnits constructor

ExchangeRate.fromMinorUnits(
  1. int exchangeRateMinorUnits, {
  2. required int decimalDigits,
  3. required CurrencyIsoCode fromCode,
  4. required CurrencyIsoCode toCode,
  5. int? toDecimalDigits,
})

Create an exchange rate from an integer holding minor units to the provided number of decimalDigits.

The toDecimalDigits is the number of decimals of the resulting Money amount. If not supplied the decimalDigits of the toCode's currency is used.

Implementation

factory ExchangeRate.fromMinorUnits(int exchangeRateMinorUnits,
        {required int decimalDigits,
        required CurrencyIsoCode fromCode,
        required CurrencyIsoCode toCode,
        int? toDecimalDigits}) =>
    ExchangeRate.fromMinorUnitsWithCurrency(exchangeRateMinorUnits,
        decimalDigits: decimalDigits,
        fromCurrency: _findCurrency(fromCode),
        toCurrency: _findCurrency(toCode),
        toDecimalDigits: toDecimalDigits);