setBigInt method

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

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

The value is written to the range [offset : offset+length]. If length is omitted, the minimum number of bytes required to store this big integer value is used.

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(10);
buffer.setBigInt(BigInt.parse('9818446744073709551615'), 0);
print(buffer); // [255, 255, 31, 236, 95, 13, 82, 66, 20, 2]

Implementation

int setBigInt(
  final BigInt value,
  final int offset, [
  final int? length,
  final Endian endian = Endian.little,
]) {
  return _setBytes(_toBytesBigInt(value, length), offset, endian);
}