toPaddedBigEndianBytes function
Derive bytearray from num where the bytearray is padded to the left with 0s to the specified width.
Implementation
Uint8List toPaddedBigEndianBytes(BigInt num, int width) {
String hex = num.toRadixString(16);
String paddedHex = hex.padLeft(width * 2, '0');
return Hex.decode(
paddedHex.substring(paddedHex.length - width * 2));
}