setBigUint method

int setBigUint(
  1. BigInt value,
  2. int offset, [
  3. int? length,
  4. Endian endian = Endian.little,
])

Writes a big unsigned integer to a region of the buffer.

The value is written to the range [offset : offset+length]. If length is omitted, it defaults to the value's byte length.

The range must satisy the relations 0offsetoffset+lengththis.length.

Returns the position of the last element written to the buffer ([offset]+[length]).

final Buffer buffer = Buffer(8);
buffer.setBigUint(BigInt.parse('18446744073709551615'), 0);
print(buffer); // [255, 255, 255, 255, 255, 255, 255, 255]

Implementation

int setBigUint(
  final BigInt value,
  final int offset, [
  final int? length,
  final Endian endian = Endian.little,
]) {
  assert(value >= BigInt.zero,
      'The [BigInt] value $value must be a positive integer.');
  return setBigInt(value, offset, length, endian);
}