roundToNDecimals function

double roundToNDecimals(
  1. double aArrondir, {
  2. int nbDecimales = 2,
})

Round a double input aArrondir to nbDecimales decimals (if not provided, 2 decimals)

Implementation

double roundToNDecimals(double aArrondir, {int nbDecimales = 2}) {
  var tempValue = (aArrondir * math.pow(10, nbDecimales.toDouble())).round();
  return tempValue / math.pow(10, nbDecimales.toDouble());
}