readString method

String readString(
  1. int length
)

Reads a String from the backing buffer

  • length: The number of bytes

Implementation

String readString(int length) {
  final list = readBuffer(length);
  final len = list.length;
  for (var i = 0; i < len; ++i) {
    if (list[i] > 127) {
      return _stringEncoder.decode(list);
    }
  }
  return String.fromCharCodes(list);
}