StreamDisposable class

Helper Class that holds and disposes stream subscriptions, sinks and timers

We can instantiate this class by calling var disposable = StreamDisposable()

Then, we can simply add StreamSubscriptions to it by calling add

  var streamToDispose = Stream.fromIterable([1, 2, 3]);
  disposable.add(streamToDispose.listen(print))

Finally, in the Stateful's Widget `dispose´ method or equivalent, we can call

disposable.dispose()

To safely dispose every subscription

Constructors

StreamDisposable()

Properties

didDispose Future<void>
Future that completes when the StreamDisposable finishes disposing
no setter
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Checks if the Disposable has been disposed
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(dynamic subscription) → void
Adds a Stream Subscription or Sink to be disposed in the future
dispose({String className = ""}) Future<void>
Dipose Resources
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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