sendMessage method

void sendMessage(
  1. Object? message
)

Sends an asynchronous message through this send port, to its corresponding ReceivePort.

The content of message can be:

In the special circumstances when two isolates share the same code and are running in the same process (e.g. isolates created via Isolate.spawn), it is also possible to send object instances (which would be copied in the process). This is currently only supported by the Dart Native platform.

The send happens immediately and doesn't block. The corresponding receive port can receive the message as soon as its isolate's event loop is ready to deliver it, independently of what the sending isolate is doing.

Implementation

void sendMessage(Object? message) {
  assert(isInitialized);
  _isolateSendPort.send(message);
}