CompositeDisposable class abstract interface

Acts as a container for multiple disposables that can be canceled at once.

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

Build composite disposable

Create a CompositeDisposable and add Disposable components (e.g HitsSearcher, FilterState, FacetList) to it:

final composite = CompositeDisposable()
    ..add(searcher)
    ..add(filterState)
    ..add(facetList);

Remove previously added Disposable:

composite.remove(facetList);

Cancel and clear

Cancel and remove all Disposables added to the composite, and keep the composite reusable:

composite.clear();

Dispose

Releases the resources of all Disposables added to the composite:

composite.dispose()
Implemented types

Constructors

CompositeDisposable()
Creates CompositeDisposable instance.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether this Disposable has already released its resources.
no setterinherited
isEmpty bool
Checks if there currently are no Disposables added
no setter
length int
Returns the total amount of currently added Disposables
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add<T extends Disposable>(T disposable) → T
Adds disposable to this composite. Throws an exception if this composite was disposed
clear() → void
Cancels all disposables added to this composite. Clears disposables collection. This composite can be reused after calling this method.
dispose() → void
Releases this Disposable resources.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(Disposable disposable, {bool shouldDispose = true}) → void
Remove disposable from this composite and cancel it if it has been removed.
toString() String
A string representation of this object.
inherited

Operators

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