StreamGroup<T> class

A collection of streams whose events are unified and sent through a central stream.

Both errors and data events are forwarded through stream. The streams in the group won't be listened to until stream has a listener. Note that this means that events emitted by broadcast streams will be dropped until stream has a listener.

If the StreamGroup is constructed using StreamGroup.new, stream will be single-subscription. In this case, if stream is paused or canceled, all streams in the group will likewise be paused or canceled, respectively.

If the StreamGroup is constructed using StreamGroup.broadcast, stream will be a broadcast stream. In this case, the streams in the group will never be paused and single-subscription streams in the group will never be canceled. Note that single-subscription streams in a broadcast group may drop events if a listener is added and later removed. Broadcast streams in the group will be canceled once stream has no listeners, and will be listened to again once stream has listeners.

stream won't close until close is called on the group and every stream in the group closes.

Implemented types

Constructors

StreamGroup()
Creates a new stream group where stream is single-subscriber.
StreamGroup.broadcast()
Creates a new stream group where stream is a broadcast stream.

Properties

hashCode int
The hash code for this object.
no setterinherited
isClosed bool
Whether the group is closed, meaning that no more streams may be added.
no setter
isIdle bool
Whether this group contains no streams.
no setter
onIdle Stream<void>
A broadcast stream that emits an event whenever this group becomes idle.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<T>
The stream through which all events from streams in the group are emitted.
no setter

Methods

add(Stream<T> stream) Future<void>?
Adds stream as a member of this group.
override
close() Future<void>
Closes the group, indicating that no more streams will be added.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(Stream<T> stream) Future<void>?
Removes stream as a member of this group.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

merge<T>(Iterable<Stream<T>> streams) Stream<T>
Merges the events from streams into a single single-subscription stream.
mergeBroadcast<T>(Iterable<Stream<T>> streams) Stream<T>
Merges the events from streams into a single broadcast stream.