roundToDecimals method
Rounds the number to the given number of decimal places.
Example:
3.14159.roundToDecimals(2); // returns 3.14
Implementation
double roundToDecimals(int decimals) {
if (isNaN || isInfinite) return this;
return safeParseDouble(toStringAsFixed(decimals));
}