intToBytes static method
Implementation
static List<int> intToBytes(
int value, {
int length = 4,
bool littleEndian = true,
}) {
List<int> bytes = [];
if (littleEndian) {
for (int i = 0; i < length; i++) {
bytes.add((value >> (i * 8)) & 0xFF);
}
} else {
for (int i = length - 1; i >= 0; i--) {
bytes.add((value >> (i * 8)) & 0xFF);
}
}
return bytes;
}