asScientific method

String asScientific()

Implementation

String asScientific() {
  String result = digits;
  final bool zero = allZeros(result);
  if (zero) {
    result = precision < 2 ? '0e0' : "0.${'0' * (precision - 1)}e0";
  } else {
    if (digits.length > 1) {
      result = insert('.', result, 1);
    }
    result += 'e${decimal - 1}';
  }
  if (negative && !zero) {
    result = '-$result';
  }
  return result;
}