Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem statement
Was wandering around this package. I saw there's just a widget builder widget rebuilding the widgets on change of the connectivity. I think it should have a widget that will just give me a listener, as I don't want to rebuild the widgets but do some action against the change.
Eg.: I want to show the users an alert if they switch to mobile data to shift back to wifi (as for instance I am downloading big files or streaming high-quality content)
Solution
I've implemented a new widget like that of the builder, but with a listenerBuilder property to just listen to changes and not rebuild the widgets.
Bonus
I've also added in
listenWhen
to only listen to specific changes. For more details, refer to the new demo page in the example.Video Sample
Screenrecorder-2022-08-08-13-32-22-500.mp4