encodeBigInt function

Uint8List encodeBigInt(
  1. BigInt number
)

Implementation

Uint8List encodeBigInt(BigInt number) {
  var data = ByteData(8);
  var _bigInt = number;
  for (var i = 1; i <= data.lengthInBytes; i++) {
    data.setUint8(data.lengthInBytes - i, _bigInt.toUnsigned(8).toInt());
    _bigInt = _bigInt >> 8;
  }
  return data.buffer.asUint8List();
}