ever method
callback
is called every time that the Rx<T> changes.
If condition
is not null the callback
only is called if condition
returns true.
Implementation
RxReaction ever(void Function(T) callback, {bool Function(T)? condition}) {
// ignore: cancel_subscriptions
final StreamSubscription subscription = stream.listen((event) {
if (condition != null) {
if (condition(event)) {
callback(event);
}
} else {
callback(event);
}
});
return RxReaction(subscription, null);
}