stream_disposable 0.0.1
stream_disposable: ^0.0.1 copied to clipboard
Package to help disposing Stream Subscriptions and Sink objects
Stream Disposable #
Package to help disposing Streams and Sinks.
Usage #
Instantiate a disposable with
var disposable = StreamDisposable()
Add StreamSubscriptions or Sinks to it by calling add
var streamToDispose = Stream.fromIterable([1, 2, 3]);
disposable.add(streamToDispose.listen(print))
In the Stateful's Widget dispose
method or equivalent, we can call
disposable.dispose(className: this.runtimeType.toString())
To safely dispose every subscription.