I'm doing my first streams in dart and I would like to print some of my values after observable operators
before they make it to the listen
, much like tap
in RxJS. Is this possible? I can't find it in RxDart either.
For example:
final pulseStream = field.control.valueChanges
.where((dynamic val) => (val as String).length < 20)
.tap(print)
.where((dynamic val) => (val as String).isNotEmpty)
.tap(print)
.where((dynamic val) => pulseController != null)
.tap(print)
.where((dynamic val) => !pulseController.isAnimating);
That is doX
operator:
RxDart | RxJS
------------------------
doOnData(print) | tap(console.log) or tap({ next: console.log })
doOnError((e, s) => print(e)) | tap({ error: console.log })
doOnDone(() => print('done')) | tap({ complete: () => console.log('complete') })