roundToDecimalPlaces static method
Round number to specified decimal places
number - The number to round
decimalPlaces - Number of decimal places
Returns rounded number
Implementation
static double roundToDecimalPlaces(double number, int decimalPlaces) {
final multiplier = pow(10, decimalPlaces);
return (number * multiplier).round() / multiplier;
}