printStruct function
For debugging, print the memory structure of a given struct.
Implementation
void printStruct(Pointer struct, int sizeInBytes) {
final words = <int>[];
final ptr = struct.cast<Uint16>();
for (var i = 0; i < sizeInBytes ~/ 2; i++) {
words.add(ptr.elementAt(i).value);
}
print(words.map((word) => word.toHexString(16)).join(', '));
}