IsolateChannel<T> class
Null safety
A StreamChannel that communicates over a ReceivePort/SendPort pair, presumably with another isolate.
The remote endpoint doesn't necessarily need to be running an IsolateChannel. This can be used with any two ports, although the StreamChannel semantics mean that this class will treat them as being paired (for example, closing the sink will cause the stream to stop emitting events).
The underlying isolate ports have no notion of closing connections. This means that stream won't close unless sink is closed, and that closing sink won't cause the remote endpoint to close. Users should take care to ensure that they always close the sink of every IsolateChannel they use to avoid leaving dangling ReceivePorts.
- Inheritance
-
- Object
- StreamChannelMixin<
T> - IsolateChannel
Constructors
- IsolateChannel(ReceivePort receivePort, SendPort sendPort)
-
Creates a stream channel that receives messages from
receivePort
and sends them oversendPort
.factory - IsolateChannel.connectReceive(ReceivePort receivePort)
-
Connects to a remote channel that was created with
IsolateChannel.connectSend.
factory
- IsolateChannel.connectSend(SendPort sendPort)
-
Connects to a remote channel that was created with
IsolateChannel.connectReceive.
factory
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
-
sink
→ StreamSink<
T> -
The sink for sending values to the other endpoint.
final
-
stream
→ Stream<
T> -
The single-subscription stream that emits values from the other endpoint.
final
Methods
-
cast<
S> () → StreamChannel< S> -
Returns a copy of this with the generic type coerced to
S
.inherited -
changeSink(
StreamSink< T> change(StreamSink<T> )) → StreamChannel<T> -
Returns a copy of this with sink replaced by
change
's return value.inherited -
changeStream(
Stream< T> change(Stream<T> )) → StreamChannel<T> -
Returns a copy of this with stream replaced by
change
's return value.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
pipe(
StreamChannel< T> other) → void -
Connects this to
other
, so that any values emitted by either are sent directly to the other.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
transform<
S> (StreamChannelTransformer< S, T> transformer) → StreamChannel<S> -
Transforms this using
transformer
.inherited -
transformSink(
StreamSinkTransformer< T, T> transformer) → StreamChannel<T> -
Transforms only the sink component of this using
transformer
.inherited -
transformStream(
StreamTransformer< T, T> transformer) → StreamChannel<T> -
Transforms only the stream component of this using
transformer
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited