Describe the bug
I cannot start 2 Events simultaneously. Must wait for first Event done before start second Event.
To Reproduce
Steps to reproduce the behavior:
EventDownloadStart to the DownloadBloc in order to start downloading. Then in main UI, I receive StateDownloadProgress(double progress).EventDownloadStop.EventDownloadStop yet but download is still in progress. Until download is done then I see the log of EventDownloadStop.Expected behavior
It seems Bloc must wait for first Event done before can be able to process next Event. But I hope Bloc can also process second event simultaneously.
Additional context
Here is the sample app: https://drive.google.com/open?id=1WiUxT_danFVBSLwZmdxQha_mAEDKtxAU
Hey @anticafe 馃憢
Thanks for reporting this and linking to the example app! I鈥檒l take a look later today 馃憤
Hi @anticafe,
I was able to achieve the desired functionality by modifying the download_bloc to maintain a StreamSubscription for the download progress instead of using await and blocking the mapEventToState loop.
If you update your bloc and flutter_bloc versions
bloc: ^0.12.0
flutter_bloc: ^0.11.0
then you can copy this version of download_bloc.dart into your application and it should work as expected.
You can also check out the flutter_bloc_with_stream example app for a simplified version.
In general, if you await on a stream in mapEventToState then you are blocking the event loop until the stream is closed.
Hope that helps and great question! 馃挴
Most helpful comment
Hey @anticafe 馃憢
Thanks for reporting this and linking to the example app! I鈥檒l take a look later today 馃憤