readUIntLE function

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

Implementation

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