You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
main() async {
listen(Reactable r, String l) =>
r.listen((v) => print('$l: $v'));
final p1 = new Property.constant('first');
final p2 = p1.map((s) => s == 'first').asProperty();
listen(p1, 'p1');
listen(p2, 'p2');
await new Future.delayed(const Duration(milliseconds:100));
listen(p1, 'p1b');
listen(p2, 'p2b');
await new Future.delayed(const Duration(milliseconds:100));
}
It seems that as map turns the property into a stream, the call to asProperty comes too late to save the value???
Incidentally it would be really nice if Property implemented map and returned a Property rather than needing to call asProperty(). Or maybe what is needed is another method with these semantics.
I find it is super common to derive properties from properties. In fact you could increasingly describe my whole app that way ;-)
The text was updated successfully, but these errors were encountered:
Looks like the current value is not actually being delivered to multiple listeners. This only happens when you add a delay, because the listener is added in another event loop.
The test case can be simplified with this:
var p =newProperty.constant(1).map((s) => s +1);
p.listen(print);
newFuture.delayed(newDuration(milliseconds:100), () {
p.listen(print);
});
I'll rename the ticket.
danschultz
changed the title
mapped properties don't have an initial value
Properties aren't delivering the current value to multiple listeners
Dec 31, 2014
The following prints
but should print
It seems that as map turns the property into a stream, the call to asProperty comes too late to save the value???
Incidentally it would be really nice if Property implemented map and returned a Property rather than needing to call asProperty(). Or maybe what is needed is another method with these semantics.
I find it is super common to derive properties from properties. In fact you could increasingly describe my whole app that way ;-)
The text was updated successfully, but these errors were encountered: