How does the combiner actually work?
Stream<bool> get isValid => Rx.combineLatest2(name1, mobile1, (name2, mobile2) => true);
If name1 and mobile1 are streams, then what are the types of name2 and mobile2 in brackets?
How does the combiner actually work?
Stream<bool> get isValid => Rx.combineLatest2(name1, mobile1, (name2, mobile2) => true);
If name1 and mobile1 are streams, then what are the types of name2 and mobile2 in brackets?
Copyright © 2021 Jogjafile Inc.
In your example,
name2andmobile2refer to the latest content that was emitted by the streamsname1andmobile1. So your question - the types ofname2andmobile2- depend on the streams that you give it.I think calling them
name1andname2actually kind of makes it a bit confusing, and perhaps it would make more sense to think of it like this:To give a concrete example, imagine that
nameis aStringandmobileisint. And imagine that what you want is a Stream of your own class calledPersonwhich has the parameternameandmobilelike this:You could combine your latest
nameand latestmobileto get aStream<Person>like this:where:
nameStreamis of typeStream<String>mobileStreamis of typeStream<int>nameis of typeStringmobileis of typeintpersonreturnsStream<Person>You can specify your class types in the function like this: