encodeBigInt static method
Encode a BigInt into bytes using big-endian encoding.
Implementation
static Uint8List encodeBigInt(BigInt number) {
// Not handling negative numbers. Decide how you want to do that.
var size = (number.bitLength + 7) >> 3;
var result = Uint8List(size);
for (var i = 0; i < size; i++) {
result[size - i - 1] = (number & _byteMask).toInt();
number = number >> 8;
}
return result;
}