toUint8List method

Uint8List toUint8List([
  1. int? length
])

Converts this BigInt into a Uint8List of size length. If length is omitted, the minimum number of bytes required to store this big integer value is used.

Implementation

Uint8List toUint8List([final int? length]) {
  final int byteLength = length ?? this.byteLength;
  assert(length == null || length >= byteLength,
      'The value $this overflows $byteLength byte(s)');
  return (Buffer(byteLength)..setBigInt(this, 0, byteLength)).asUint8List();
}