onEvent property

  1. @Since.new("3.13")
set onEvent (void callback(Isolate))

Event notify callback for the isolate.

Provided callback will be called once for every new event which isolate needs to react to. Pending events can be then later be drained by calling Isolate.handleEvent.

Provided callback must be deeply immutable and will be called on an arbitrary thread and not necessarily within any isolate. See NativeCallable.isolateGroupBound.

IMPORTANT: Isolate.handleEvent MUST NOT be called from the callback as this will cause a dead-locks of the Dart execution environment.

Similar to Dart_SetMessageNotifyCallback Dart VM C API.

Implementation

@Since("3.13")
external void set onEvent(void Function(Isolate) callback);