bloc
bloc copied to clipboard
question: Could you please enhance your 'Infinite list' example from docs?
It would be great to see, how to properly implement refreshing + pagination + search.
Hi @AlexandrFarkas 👋 Thanks for opening an issue!
This is a great idea and in the meantime some existing references are:
- refreshing - see weather example
- search - see fluttersaurus
Hi @felangel Well, I would like to see them in conjunction.
- How to avoid race condition between event handlers.
- How to debounce search events
- How to throttle refresh and next page events (droppable strategy)
- How to allow other events process normally (without throttling and debounce)
"How to avoid race condition between event handlers." is important. For example, I don't want nextPage completed, when user already called refresh. It might happen that refresh emits new items first, and nextPage (after long request) applies new portion from previous result. It either messes up pagination or overrides refresh results (depending on implementation).
Handling the race conditions in this case is available with the restartable transformer right?
This is a great opportunity to showoff the new concurrency features
I guess one way to achieve this is to have a cancelable operations (or cancelable requests if dealing with http API) and have an event debouncer (e.g. rxdart's debounce extension).