StreamChannelController<T> class

A controller for exposing a new StreamChannel.

This exposes two connected StreamChannels, local and foreign. The user's code should use local to emit and receive events. Then foreign can be returned for others to use. For example, here's a simplified version of the implementation of new IsolateChannel:

StreamChannel isolateChannel(ReceivePort receivePort, SendPort sendPort) {
  var controller = new StreamChannelController(allowForeignErrors: false);

  // Pipe all events from the receive port into the local sink...

  // ...and all events from the local stream into the send port., onDone: receivePort.close);

  // Then return the foreign controller for your users to use.
  return controller.foreign;


StreamChannelController({bool allowForeignErrors = true, bool sync = false})
Creates a StreamChannelController.


foreign StreamChannel<T>
The foreign channel.
no setter
hashCode int
The hash code for this object.
no setterinherited
local StreamChannel<T>
The local channel.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.