getString method

dynamic getString(
  1. dynamic size
)

Implementation

getString(size) {
  // note: safari 9 doesn't support Uint8Array.indexOf; create intermediate array instead
  List<int> a = List<int>.filled(size, 0);

  for (var i = 0; i < size; i++) {
    a[i] = getUint8();
  }

  var nullByte = a.indexOf(0);
  if (nullByte >= 0) a = a.sublist(0, nullByte);

  return LoaderUtils.decodeText(a);
}