W3cubDocs

/Dart 2

ping method

void ping (SendPort responsePort, { Object response, int priority: immediate })

Requests that the isolate send response on the responsePort.

The response object must follow the same restrictions as enforced by SendPort.send. It is recommended to only use simple values that can be sent to all isolates, like null, booleans, numbers or strings.

If the isolate is alive, it will eventually send response (defaulting to null) on the response port.

The priority must be one of immediate or beforeNextEvent. The response is sent at different times depending on the ping type:

  • immediate: 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 and processed, but may be during execution of another event.
  • beforeNextEvent: 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.

Implementation

external void ping(SendPort responsePort,
    {Object response, int priority: immediate});

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-isolate/Isolate/ping.html