flutter_bloc_tutorial
flutter_bloc_tutorial copied to clipboard
Bug when using withLatestFrom with nonsynced streams
https://github.com/tensor-programming/flutter_bloc_tutorial/blob/7c1cea39047a700f677e5ed1165ea091b2f619ae/lib/bloc.dart#L20-L24
I didn't try to run the code but I think there's a bug here when two queries are made in quick succession.
Consider the following time line:
- query for "dog"
- call
api.get("dog") - query for "cat"
- call
api.get("cat") - receive API response for "dog"
- log "Results for cat" (because "cat" is the latest value in
_querystream) - receive API response for "cat"
- log "Results for cat"
That is, it logs "Results for cat" twice and never logs "Results for dog" because _query and _results streams are not synced/zipped.