Wake.native constructor

Wake.native({
  1. required NativePointer callback,
  2. NativePointer userData = NativePointer.nullPointer,
  3. NativePointer releaseUserData = NativePointer.nullPointer,
})

Creates a native registration from callback, userData, and releaseUserData, which native code in the host supplies. The binding copies them unchanged.

The first call that carries the registration consumes it, and a later call throws an invalid-state error. Native code releases the context of a call that it accepts, and the binding calls releaseUserData for a call that native code does not accept.

Implementation

Wake.native({
  required NativePointer callback,
  NativePointer userData = NativePointer.nullPointer,
  NativePointer releaseUserData = NativePointer.nullPointer,
}) : callback = null {
  nativeRegistrations[this] = NativeRegistration(
    [callback],
    userData,
    releaseUserData,
  );
}