intToBytes static method

Uint8List intToBytes(
  1. int integer,
  2. int length
)

Implementation

static Uint8List intToBytes(int integer, int length) {
  Uint8List ret = Uint8List(length);
  for (int i = 0; i < length; i++) {
    ret[i] = integer & 0xff;
    integer = (integer - ret[i]) ~/ 256;
  }
  return AppHelpers.reverse(ret);
}