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);
  value = Decimal.fromInt(minorUnits) / Decimal.ten.pow(scale);
}