DisposeBag class
Class that helps closing sinks and canceling stream subscriptions
- Implemented types
Constructors
-
DisposeBag([Iterable<
Object> disposables = const <Object>[], String? tag]) -
Construct a DisposeBag with
disposables
iterable.disposables
must be an Iterable of StreamSubscriptions or a Sinks.
Properties
-
disposables
→ Set<
Object> -
Gets all disposable or empty set if this bag has been disposed or is disposing.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClearing → bool
-
Returns true if this bag is clearing.
no setteroverride
- isDisposed → bool
-
Returns true if this bag has been disposed.
no setteroverride
- length → int
-
Returns the number of currently held Disposables.
Return
0
if this bag has been disposed or is disposing.no setteroverride - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
Object disposable) → Future< bool> -
Adds a disposable to this container or disposes it if this bag has been disposed or is disposing.
override
-
addAll(
Iterable< Object> disposables) → Future<void> -
Atomically adds the given iterable of Disposables to this bag
or disposes them all if this bag has been disposed or is disposing.
override
-
clear(
) → Future< void> -
Atomically clears the container, then disposes all the previously contained Disposables.
This method can be called multiple times.
override
-
delete(
Object disposable) → bool -
Removes (but does not dispose) the given disposable if it is part of this container.
override
-
dispose(
) → Future< void> -
Dispose the resource, the operation should be called once time.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
Object disposable) → Future< bool> -
Removes and disposes the given disposable if it is part of this container.
override
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited