parseNumber method

num parseNumber(
  1. IntlStream input
)

Parse the number portion of the input, i.e. not any prefixes or suffixes, and assuming NaN and Infinity are already handled.

Implementation

num parseNumber(IntlStream input) {
  if (gotNegative) {
    _normalized.write('-');
  }
  while (!done && !input.atEnd()) {
    var digit = asDigit(input.peek());
    if (digit != null) {
      _normalized.writeCharCode(constants.asciiZeroCodeUnit + digit);
      input.next();
    } else {
      processNonDigit();
    }
    checkSuffixes();
  }

  var normalizedText = _normalized.toString();
  num? parsed = int.tryParse(normalizedText);
  parsed ??= double.parse(normalizedText);
  return parsed / scale;
}