isOddDouble function Null safety

bool isOddDouble(
  1. double a,
  2. int fractionDigits
)

Check if a is an Odd number after a truncation.

  • fractionDigits : number of decimal digits

Implementation

bool isOddDouble(double a, int fractionDigits) {
  var aT = truncate(a, fractionDigits);
  var aTString = aT.toString();
  var last = int.parse(aTString[aTString.length - 1]);
  return last % 2 != 0;
}