Use transformers instead of forwarding reactables
danschultz opened this issue · comments
Dan Schultz commented
Most of the transformation methods right now, i.e. flatMapLatest()
, debounce()
, are sub-classes of _ForwardingReactable
.
A better approach is to create these as implementations of StreamTransformer
. This utilizes some of the built in behavior of Dart and also opens the door for giving developers a choice of how they want to apply the transformation.
For example, if you only had a Dart stream, you could still utilize debounce by doing:
var stream = new Stream.fromIterable([1]);
stream.transform(new Debounce(new Duration(seconds: 1));