Decimal.fromBigInt constructor

Decimal.fromBigInt(
  1. BigInt coefficient, {
  2. int scale = 0,
})

Creates coefficient × 10^(-scale), normalizing trailing zeroes.

Implementation

factory Decimal.fromBigInt(BigInt coefficient, {int scale = 0}) {
  if (coefficient == BigInt.zero) return zero;
  return Decimal._digits(
    coefficient.abs().toString(),
    coefficient.isNegative,
    scale,
  );
}