generateDigits function

List<String> generateDigits(
  1. num value
)

Implementation

List<String> generateDigits(num value) {
  bool isFractional = containsDecimal(value);
  String stringValue = "$value";
  if (isFractional) {
    List<String> tempList = stringValue.split('.');

    String exponent = tempList[1];
    String mantissa = tempList[0];
    int mantissaLength = mantissa.length;

    List<String> characters = <String>[];

    for (int i = 0; i < mantissaLength; i++) {
      characters.add(mantissa[i]);
    }
    characters.add('.');

    if (exponent.length >= 2) {
      exponent = exponent.substring(0, 2);
    } else {
      exponent = exponent.padRight(2, '0');
    }

    for (int i = 0; i < exponent.length; i++) {
      characters.add(exponent[i]);
    }

    return characters;
  } else {
    return stringValue.split('');
  }
}