u64beToBigInt static method

BigInt u64beToBigInt(
  1. Uint8List bytes, [
  2. int offset = 0
])

Decodes 8 bytes big-endian into a non-negative BigInt.

HINT: Provided for completeness; rarely needed by this protocol.

Implementation

static BigInt u64beToBigInt(Uint8List bytes, [int offset = 0]) {
  if (offset < 0 || offset + 8 > bytes.length) {
    throw RangeError.range(offset, 0, bytes.length - 8, 'offset', 'Need 8 bytes starting at offset.');
  }
  BigInt v = BigInt.zero;
  for (var i = 0; i < 8; i++) {
    v = (v << 8) | BigInt.from(bytes[offset + i]);
  }
  return v;
}