numberToBytes function

List<int> numberToBytes(
  1. dynamic number
)

Converts the given number, either a int or a BigInt to a list of bytes representing the same value.

Implementation

List<int> numberToBytes(dynamic number) {
  if (number is BigInt) return p_utils.encodeBigInt(number);

  var hexString = toHex(number, pad: true);
  return hex.decode(hexString);
}