ExchangeRate.fromNumWithCurrency constructor

ExchangeRate.fromNumWithCurrency(
  1. num rateAsNum, {
  2. required int decimalDigits,
  3. required Currency fromCurrency,
  4. required Currency toCurrency,
  5. int? toDecimalDigits,
})

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

The amount is stored, rounded to decimalDigits decimal places.

The decimalDigits is the number of decimals of the resulting Money amount. If not supplied the decimalDigits of the toCurrency's is

Implementation

ExchangeRate.fromNumWithCurrency(
  num rateAsNum, {
  required int decimalDigits,
  required this.fromCurrency,
  required this.toCurrency,
  this.toDecimalDigits,
}) {
  exchangeRate = Fixed.fromNum(rateAsNum, scale: decimalDigits);
}