ExchangeRate.fromFixed constructor

ExchangeRate.fromFixed(
  1. Fixed exchangeRate, {
  2. required CurrencyIsoCode fromIsoCode,
  3. required CurrencyIsoCode toIsoCode,
  4. int? toDecimalDigits,
})

Create an exchange rate from a Fixed decimal.

The target currency, as defined by toIsoCode, describes the currency of the Money instance that is returned by the excchange.

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

The toDecimalDigits for the exchangeRate should normally be quoted to a high precision such as 8 decimal places.

Implementation

factory ExchangeRate.fromFixed(Fixed exchangeRate,
        {required CurrencyIsoCode fromIsoCode,
        required CurrencyIsoCode toIsoCode,
        int? toDecimalDigits}) =>
    ExchangeRate.fromFixedWithCurrency(exchangeRate,
        fromCurrency: _findCurrency(fromIsoCode),
        toCurrency: _findCurrency(toIsoCode),
        toDecimalDigits: toDecimalDigits);