Package to help disposing Stream Subscriptions and Sink objects
Stream Disposable #
Package to help disposing Streams and Sinks.
Simple Usage #
Instantiate a disposable with
var disposable = StreamDisposable()
Add StreamSubscriptions or Sinks to it by calling
var streamToDispose = Stream.fromIterable([1, 2, 3]); disposable.add(streamToDispose.listen(print))
In the Stateful's Widget
dispose method or equivalent, we can call
To safely dispose every subscription.
Available Methods #
Futurethat completes when the
bool isDisposedBoolean value to check if the disposable has been disposed.
Future<void> disposeDispose the current Sink and StreamSusbcription that were addded to this instance. Throws an error if a
disposeaction is in process or if the disposable has been disposed already.