feat: Expose stream controller onCancel and hasListener #3575
Labels
enhancement candidate
Candidate for enhancement but additional research is needed
pkg:bloc
This issue is related to the bloc package
Description
It would be great to know when all active listeners to a bloc are removed or whether there are any listeners to a bloc.
Desired Solution
Expose the stream controller's
onCancel
callback andhasListener
.Additional Context
This would be useful for removing or changing state when a screen goes out of view. Say you need to have a bloc that wraps the whole app but the state stored is large and is only needed on 2 pages. Right now I would have to put add an event in the dispose method of the page. It would be good if there was a
onCancel
override similar toonChange
. ThisonCancel
could be called when the stream controllersonCancel
is called. HavinghasListener
available would be a nice to have as well.The text was updated successfully, but these errors were encountered: