toStringAsExponential method

String? toStringAsExponential([
  1. int? fractionDigits
])

An exponential string-representation of this number.

Converts this number to a double before computing the string representation.

If fractionDigits is given, then it must be an integer satisfying: 0 <= fractionDigits <= 20. In this case the string contains exactly fractionDigits after the decimal point. Otherwise, without the parameter, the returned string uses the shortest number of digits that accurately represent this number.

If fractionDigits equals 0, then the decimal point is omitted. Examples:

Obj(1).toStringAsExponential();       // 1e+0
Obj(1).toStringAsExponential(3);      // 1.000e+0
Obj(123456).toStringAsExponential();  // 1.23456e+5
Obj(123456).toStringAsExponential(3); // 1.235e+5
Obj(123).toStringAsExponential(0);    // 1e+2

Implementation

String? toStringAsExponential([int? fractionDigits]) =>
    value?.toStringAsExponential(fractionDigits);