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...
receivePort.pipe(controller.local.sink);
// ...and all events from the local stream into the send port.
controller.local.stream.listen(sendPort.send, onDone: receivePort.close);
// Then return the foreign controller for your users to use.
return controller.foreign;
}
Constructors
- StreamChannelController({bool allowForeignErrors = true, bool sync = false})
- Creates a StreamChannelController.
Properties
-
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
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited