CompositeSubscription class

Acts as a container for multiple subscriptions that can be canceled at once e.g. view subscriptions in Flutter that need to be canceled on view disposal

Can be cleared or disposed. When disposed, cannot be used again.

Example

// init your subscriptions composite.add(stream1.listen(listener1)) ..add(stream2.listen(listener1)) ..add(stream3.listen(listener1));

// clear them all at once composite.clear();

Constructors

CompositeSubscription()

Properties

allPaused bool
Whether all managed StreamSubscriptions are currently paused.
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
isDisposed bool
Checks if this composite is disposed. If it is, the composite can't be used again and will throw an error if you try to add more subscriptions to it.
read-only
isEmpty bool
Checks if there currently are no StreamSubscriptions added
read-only
isNotEmpty bool
Checks if there currently are StreamSubscriptions added
read-only
length int
Returns the total amount of currently added StreamSubscriptions
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

add<T>(StreamSubscription<T> subscription) StreamSubscription<T>
Adds new subscription to this composite. [...]
clear() → void
Cancels all subscriptions added to this composite. Clears subscriptions collection. [...]
dispose() → void
Cancels all subscriptions added to this composite. Disposes this. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
pauseAll([Future resumeSignal]) → void
Pauses all subscriptions added to this composite.
remove(StreamSubscription subscription) → void
Cancels subscription and removes it from this composite.
resumeAll() → void
Resumes all subscriptions added to this composite.
toString() String
Returns a string representation of this object.
inherited

Operators

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