feat: An eventHandlerTransformer to control how multiple event handlers emit their values
- Dominant language
- Dart
- Stars
- 12.5k
- Forks
- 3.4k
- PR merge metrics
- No merged PRs in 30d
Description
**Description**
Hello, I ported my blocs to the new `on()` API and things mostly worked :) However I was also affected by the issue raised in #2790 since my blocs expect event handling to be done sequentially. Setting all handlers to sequential() wasn't enough because handling *between multiple event handlers* is always done concurrently (right?)
The suggested solution to use a single `on()` handler with a sequential transformer worked, but it does take away from the elegance of the new API imo
**Proposal**
It would be cool if the event handling order could also be configured. Perhaps an `eventHandlerTransformer` (that gets passed into the constructor?) which lets you configure whether two or more event handlers are run concurrently, sequentially, etc.
So for example, a `Reload` event handler could be droppable, so multiple `Reload` events added in quick succession will only process the first one and drop the succeeding ones. But on a bloc level, inter-event handling could be sequential, so multiple `Reload` events followed by an `Upvote` event in quick succession will result in one reload that finishes (others dropped), followed by the handling of the upvote event after the reload.
Contributor guide
Assessment
This issue has not been assessed yet.