void ping(
SendPort responsePort,
[int pingType = IMMEDIATE]
)

Request that the isolate send a response on the responsePort.

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

If the isolate is alive, it will eventually send a null response on the response port.

The pingType must be one of IMMEDIATE, BEFORE_NEXT_EVENT or AS_EVENT. The response is sent at different times depending on the ping type:

  • IMMEDIATE: The the isolate responds as soon as it receives the control message. This is after any previous control message from the same isolate has been received.

  • BEFORE_NEXT_EVENT: The response 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 response is not sent until all prevously sent non-control messages from the current isolate to the receiving isolate have been processed. The ping effectively puts the response 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

/**
 * Request that the isolate send a response on the [responsePort].
 *
 * WARNING: This method is experimental and not handled on every platform yet.
 *
 * If the isolate is alive, it will eventually send a `null` response on
 * the response port.
 *
 * The [pingType] must be one of [IMMEDIATE], [BEFORE_NEXT_EVENT] or
 * [AS_EVENT].
 * The response is sent at different times depending on the ping type:
 *
 * * `IMMEDIATE`: The the isolate responds as soon as it receives the
 *     control message. This is after any previous control message
 *     from the same isolate has been received.
 * * `BEFORE_NEXT_EVENT`: The response 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 response is not sent until all prevously sent
 *     non-control messages from the current isolate to the receiving isolate
 *     have been processed.
 *     The ping effectively puts the response 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 ping(SendPort responsePort, [int pingType = IMMEDIATE]);