subsink

Creator: coderz1093

Last updated:

0 purchases

subsink Image
subsink Images

Languages

Categories

Add to Cart

Description:

subsink

SubSink #
Stream subscription sink for canceling gracefully in a component.
SubSink is a dead simple class to absorb stream subscriptions in an array.
Call cancel() to unsubscribe all of them, as you would do in your widget's dispose lifecycle event.
Getting Started #
class _AppLifecycleReactorState extends State<AppLifecycleReactor> {

final SubSink subSink = new SubSink();
final NumberCreator nc1 = new NumberCreator();
final NumberCreator nc2 = new NumberCreator();

@override
void initState() {
super.initState();

subSink.sink = nc1.stream.listen((event) {
print("nc1 = $event");
});

subSink.sink = nc2.stream.listen((event) {
print("nc2 = $event");
});
}

@override
void dispose() {
subSink.cancel();
super.dispose();
}

}

copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.