arrayifyInteger function

Uint8List arrayifyInteger(
  1. int value
)

@param {int} value

This function takes an integer value and converts it to a Uint8List.

@returns {Uint8List}

Implementation

Uint8List arrayifyInteger(int value) {
  if (value == 0) {
    return Uint8List.fromList([0x80]);
  }
  List<int> result = [];
  while (value > 0) {
    result.insert(0, value & 0xff);
    value >>= 8;
  }

  return Uint8List.fromList(result);
}