toFixed method

String toFixed(
  1. int fractionDigits
)

Formats the number to a fixed number of decimal places.

Example:

3.14159.toFixed(2); // "3.14"

Implementation

String toFixed(int fractionDigits) =>
    toDouble().toStringAsFixed(fractionDigits);