David Wild
David Wild

Reputation: 203

Dart: Stream depends on other stream

I have a stream Stream<List<String>> aStream, it contains references. I want a stream Stream<List<T>> bStream that triggers when the references change and when the content of the reference changes.

what i tried so far is: `

await for(List aList in aStream){
      yield* StreamGroup.merge(aList.entries.map((String reference){
        return refrencefunction(aString);
      }));
    }    

`

Thanks for your help

Upvotes: 0

Views: 294

Answers (1)

ejain
ejain

Reputation: 3614

If refrencefunction returns a Stream for each reference, and you want to yield a List<T> containing all currently referenced values whenever any of the referenced values change, you'll have to manage a stream subscription for each reference, and keep a copy of the last value for each reference. Which I'm afraid won't quite fit on a single line :-)

Upvotes: 1

Related Questions