readString method

String readString()

Implementation

String readString() {
  final len = readInt32();
  final start = _pos, end = start + len;
  // ASCII, the common case, needs no decoder: check eight bytes at a time and
  // build the string from the bytes directly (about 3x faster at 1 KiB, AOT).
  // dart2js has no 64-bit ByteData access, so the web keeps the decoder.
  final s = !kNitroWeb && _isAscii(start, end) ? String.fromCharCodes(_bytes, start, end) : _decodeUtf8(start, end);
  _pos = end;
  return s;
}