flutter_offline
flutter_offline copied to clipboard
Add new listener builder widget
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
https://user-images.githubusercontent.com/47249618/183369736-c059dd38-c82e-42d1-b88c-f84b311251a1.mp4
Thanks. I was looking for the same.