- 
                Notifications
    
You must be signed in to change notification settings  - Fork 30
 
Open
Description
flutter_bloc_tutorial/lib/bloc.dart
Lines 20 to 24 in 7c1cea3
| _results = _query.distinct().asyncMap(api.get).asBroadcastStream(); | |
| _log = Observable(results) | |
| .withLatestFrom(_query.stream, (_, query) => 'Results for $query') | |
| .asBroadcastStream(); | 
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.
Metadata
Metadata
Assignees
Labels
No labels