void kill(
[int priority = BEFORE_NEXT_EVENT]
)

Requests the isolate to shut down.

WARNING: This method is experimental and not handled on every platform yet.

The isolate is requested to terminate itself. The priority argument specifies when this must happen.

The priority must be one of IMMEDIATE, BEFORE_NEXT_EVENT or AS_EVENT. The shutdown is performed at different times depending on the priority:

  • IMMEDIATE: The the isolate shuts down as soon as possible. Control messages are handled in order, so all previously sent control events from this isolate will all have been processed. The shutdown should happen no later than if sent with BEFORE_NEXT_EVENT. It may happen earlier if the system has a way to shut down cleanly at an earlier time, even during the execution of another event.

  • BEFORE_NEXT_EVENT: The shutdown is scheduled for the next time control returns to the event loop of the receiving isolate, after the current event, and any already scheduled control events, are completed.

  • AS_EVENT: The shutdown does not happen until all prevously sent non-control messages from the current isolate to the receiving isolate have been processed. The kill operation effectively puts the shutdown into the normal event queue after previously sent messages, and it is affected by any control messages that affect normal events, including pause. This can be used to wait for a another event to be processed.

Source

/**
 * Requests the isolate to shut down.
 *
 * WARNING: This method is experimental and not handled on every platform yet.
 *
 * The isolate is requested to terminate itself.
 * The [priority] argument specifies when this must happen.
 *
 * The [priority] must be one of [IMMEDIATE], [BEFORE_NEXT_EVENT] or
 * [AS_EVENT].
 * The shutdown is performed at different times depending on the priority:
 *
 * * `IMMEDIATE`: The the isolate shuts down as soon as possible.
 *     Control messages are handled in order, so all previously sent control
 *     events from this isolate will all have been processed.
 *     The shutdown should happen no later than if sent with
 *     `BEFORE_NEXT_EVENT`.
 *     It may happen earlier if the system has a way to shut down cleanly
 *     at an earlier time, even during the execution of another event.
 * * `BEFORE_NEXT_EVENT`: The shutdown is scheduled for the next time
 *     control returns to the event loop of the receiving isolate,
 *     after the current event, and any already scheduled control events,
 *     are completed.
 * * `AS_EVENT`: The shutdown does not happen until all prevously sent
 *     non-control messages from the current isolate to the receiving isolate
 *     have been processed.
 *     The kill operation effectively puts the shutdown into the normal event
 *     queue after previously sent messages, and it is affected by any control
 *     messages that affect normal events, including `pause`.
 *     This can be used to wait for a another event to be processed.
 */
external void kill([int priority = BEFORE_NEXT_EVENT]);