MultiStreamController<T> class

An enhanced stream controller provided by Stream.multi.

Acts like a normal asynchronous controller, but also allows adding events synchronously. As with any synchronous event delivery, the sender should be very careful to not deliver events at times when a new listener might not be ready to receive them. That generally means only delivering events synchronously in response to other asynchronous events, because that is a time when an asynchronous event could happen.

Implemented types
Annotations
  • @Since("2.9")

Constructors

MultiStreamController()

Properties

doneFuture
read-only, inherited
A future which is completed when the stream controller is done sending events. [...]
hashCodeint
read-only, inherited
The hash code for this object. [...]
hasListenerbool
read-only, inherited
Whether there is a subscriber on the Stream.
isClosedbool
read-only, inherited
Whether the stream controller is closed for adding more events. [...]
isPausedbool
read-only, inherited
Whether the subscription would need to buffer events. [...]
onCancel ↔ (FutureOr<void> Function?()?)
read / write, inherited
The callback which is called when the stream is canceled. [...]
onListen ↔ (void Function?()?)
read / write, inherited
The callback which is called when the stream is listened to. [...]
onPause ↔ (void Function?()?)
read / write, inherited
The callback which is called when the stream is paused. [...]
onResume ↔ (void Function?()?)
read / write, inherited
The callback which is called when the stream is resumed. [...]
runtimeTypeType
read-only, inherited
A representation of the runtime type of the object.
sinkStreamSink<T>
read-only, inherited
Returns a view of this object that only exposes the StreamSink interface.
streamStream<T>
read-only, inherited
The stream that this controller is controlling.

Methods

add(T event) → void
inherited
Sends a data event. [...]
addError(Object error, [StackTrace? stackTrace]) → void
inherited
Sends or enqueues an error event. [...]
addErrorSync(Object error, [StackTrace? stackTrace]) → void
Adds and delivers an error event. [...]
addStream(Stream<T> source, {bool? cancelOnError}) → Future
inherited
Receives events from source and puts them into this controller's stream. [...]
addSync(T value) → void
Adds and delivers an event. [...]
close() → Future
inherited
Closes the stream. [...]
closeSync() → void
Closes the controller and delivers a done event. [...]
noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed. [...]
toString() → String
inherited
A string representation of this object. [...]

Operators

operator ==(Object other) → bool
inherited
The equality operator. [...]

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-async/MultiStreamController-class.html