ExchangeRate.fromNum constructor

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

Create an exchange rate from an integer or decimal holding major units

The exchangeRate is stored, rounded to decimalDigits decimal places.

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

Implementation

factory ExchangeRate.fromNum(
  num exchangeRate, {
  required int decimalDigits,
  required CurrencyIsoCode fromCode,
  required CurrencyIsoCode toCode,
  int? toDecimalDigits,
}) =>
    ExchangeRate.fromNumWithCurrency(exchangeRate,
        decimalDigits: decimalDigits,
        fromCurrency: _findCurrency(fromCode),
        toCurrency: _findCurrency(toCode),
        toDecimalDigits: toDecimalDigits);