encodeBigInt function
Implementation
Uint8List encodeBigInt(
BigInt number, {
Endian endian = Endian.little,
int? bitLength,
}) {
final bl = (bitLength != null) ? bitLength : number.bitLength;
final int size = (bl + 7) >> 3;
final result = Uint8List(size);
for (int i = 0; i < size; i++) {
result[endian == Endian.little ? i : size - i - 1] =
(number & BigInt.from(0xff)).toInt();
number = number >> 8;
}
return result;
}