StreamSubscriptionLifecycleRaiiExt<T> extension
Extension for managing StreamSubscription lifecycle.
Example usage:
class MyWidgetState extends State<MyWidget> with RaiiStateMixin {
@override
void initLifecycle() {
super.initLifecycle();
myStream.listen(onData).withLifecycle(
this,
debugLabel: 'MyStreamSubscription',
);
}
}
- on
Methods
-
withLifecycle(
RaiiLifecycleAware lifecycleAware, {String? debugLabel}) → StreamSubscription< T> -
Available on StreamSubscription<
Attaches this StreamSubscription to a RaiiLifecycleAware object.T> , provided by the StreamSubscriptionLifecycleRaiiExt extension