Fixed.fromInt constructor

Fixed.fromInt(
  1. int minorUnits, {
  2. int scale = 2,
})

Creates Fixed scale decimal from minorUnits with the given scale.

scale defaults to 2 if not passed.

e.g.

final fixed = Fixed.fromInt(100, scale: 2)
print(fixed) : 1.00

Implementation

Fixed.fromInt(int minorUnits, {this.scale = 2}) {
  _checkScale(scale);
  // final intrinsicScale = minorUnits.toString().length;
  // if (intrinsicScale < scale) {
  //   this.minorUnits =
  //       BigInt.from(minorUnits) * BigInt.from(10).pow(scale
  //          - intrinsicScale);
  // } else {
  this.minorUnits = BigInt.from(minorUnits);
  // }
}