packUint32BE function
Pack a 32-bit integer into a Big-Endian (BE) Uint8List. This function takes a 32-bit integer 'value' and packs it into a Uint8List in Big-Endian (BE) format, where the most significant byte is stored at the lowest index and the least significant byte at the highest index. It returns the resulting Uint8List representation of the integer.
Implementation
Uint8List packUint32BE(int value) {
/// Create a Uint8List with a length of 4 bytes to store the packed value.
var bytes = Uint8List(4);
/// Pack the 32-bit integer into the Uint8List in Big-Endian order.
bytes[0] = (value >> 24) & 0xFF;
bytes[1] = (value >> 16) & 0xFF;
bytes[2] = (value >> 8) & 0xFF;
bytes[3] = value & 0xFF;
/// Return the packed Uint8List.
return bytes;
}