ReceivePort constructor Null safety

ReceivePort(
  1. [String debugName = '']
)

Opens a long-lived port for receiving messages.

A ReceivePort is a non-broadcast stream. This means that it buffers incoming messages until a listener is registered. Only one listener can receive messages. See Stream.asBroadcastStream for transforming the port to a broadcast stream.

The optional debugName parameter can be set to associate a name with this port that can be displayed in tooling.

A receive port is closed by canceling its subscription.

Implementation

external factory ReceivePort([String debugName = '']);