@frankpepermans
The getter is just a workaround so that Angular doesn't go into an update loop. On each update cycle, it will invoke your subject.startWith(), this will yield a new Stream instance on every call, causing overflow. If you store the Stream as a reference, as with that getter, you can overcome that issue.
startWith()
that is responsible for such a behaviour ? I kind of expected the same instance to be returned each time as you have noticed.
_login
.map<Request>(_formRequest)
.doOnData((_) {
_attemptLogin.sink.add(true);
})
.asyncMap(Auth.login)
.doOnData((_) {
_attemptLogin.sink.add(false);
})
.listen(_userAuth.sink.add);
I can’t seem to get the latest version to execute the asyncMap()
Yeah, was pondering about partition as well a while ago, thing is, it doesn't work out nicely without destructuring, e.g.final s1, s2 = stream.partition(...)
If you yiled a List, then there is the danger of losing type safety, e.g.final list = stream.partition((event) => event is String);
the List would need to be a List<Stream<dynamic>>
Ultimately, using a new type, like Pair<S, T> could be best, to return a partition result. This object would then have 2 getters which can be typed