toNativeGUID method

Pointer<GUID> toNativeGUID({
  1. Allocator allocator = malloc,
})

Copy the GUID to unmanaged memory and return a pointer to the memory location.

It is the caller's responsibility to free the memory at the pointer location, for example by calling calloc's free method.

Implementation

Pointer<GUID> toNativeGUID({Allocator allocator = malloc}) {
  final pGUID = allocator<Uint8>(16);

  for (var i = 0; i < 16; i++) {
    pGUID[i] = bytes[i];
  }

  return pGUID.cast<GUID>();
}