readUIntLE function

BigInt readUIntLE(
  1. BufferPipe pipe,
  2. int byteLength
)

Implementation

BigInt readUIntLE(BufferPipe pipe, int byteLength) {
  var val = BigInt.from(safeRead(pipe, 1)[0]);
  var mul = BigInt.one;
  var i = 0;
  while (++i < byteLength) {
    mul *= BigInt.from(256);
    final byte = BigInt.from(safeRead(pipe, 1)[0]);
    val = val + mul * byte;
  }
  return val;
}