interval method

RxReaction interval(
  1. Duration duration,
  2. void callback(
    1. T
    )
)

the callback will be called every certain time interval ignoring the other changes

Implementation

RxReaction interval(Duration duration, void Function(T) callback) {
  var debouncer = Debouncer(duration);
  // ignore: cancel_subscriptions
  final StreamSubscription subscription = stream.listen((event) {
    if (!debouncer.isRunning) {
      debouncer.call(() {
        callback(event);
        debouncer = Debouncer(duration);
      });
    }
  });
  return RxReaction(subscription, debouncer);
}