Update streams based on filters in Dart/Flutter Update streams based on filters in Dart/Flutter dart dart

Update streams based on filters in Dart/Flutter


Your assumption is correct. You need to create a third steam that takes both your JSON and Filter streams and combine both into a custom result.

This is usually done with a Stream transformer. Using myStream.transform method. But this is kinda complicated.

To make things far easier, there's a package called rxdart which basically subclass Stream and adds a few common transformers.

Using rxdart, you could create this third stream by using combineLatest operator

Observable<List<String>> list;Observable<String> filter;final output = Observable.combineLatest2(filter, list, (String filter, List<String> list) {  return list.where((str) => str.startsWith(filter));});

More informations on reactivex operators here