Is there an easy way to sort the event queue of a flutter bloc by a value of the event class? E.g. I have a class MyEvent with a int property and the event queue looks like this:
[MyEvent(5), MyEvent(3), MyEvent(7), AnotherEvent(), MyEvent(2), MyEvent(1)]
I want to transform the event queue/stream so that the event with the lowest int property is executed first -> [MyEvent(3), MyEvent(5), MyEvent(7), AnotherEvent(), MyEvent(1), MyEvent(2)]
It should be possible by overriding transformEvents
somehow and maybe using an extension of rxdart, but I wasn't able to get it right and would be glad if somebody could help me out. Thanks in advance!