Money.fromBigIntWithCurrency constructor

Money.fromBigIntWithCurrency(
  1. BigInt minorUnits,
  2. Currency currency, {
  3. int? decimalDigits,
})

Creates an instance of Money from an amount represented by minorUnits which is in the minorUnits of the currency, e.g (cents).

e.g. USA dollars with 2 decimal places.

final usd = Currency.create('USD', 2);

500 cents is $5 USD. let fiveDollars = Money.fromBigIntWithCurrency(BigInt.from(500), usd);

Implementation

factory Money.fromBigIntWithCurrency(BigInt minorUnits, Currency currency,
        {int? decimalDigits}) =>
    Money._from(
        Fixed.fromBigInt(minorUnits,
            scale: decimalDigits ?? currency.decimalDigits),
        currency);