bigIntToBytes function
Convert BigInt to bytes
Implementation
List<int> bigIntToBytes(BigInt number, int size, bool isLittleEndian) {
final List<int> result = List.filled(size, 0);
int i = 0;
while (number > BigInt.zero && i < size) {
result[isLittleEndian ? i : (size - i - 1)] =
(number & BigInt.from(0xff)).toInt();
number = number >> 8;
i++;
}
return result;
}