sampleTime method

Observable<T> sampleTime (
  1. Duration duration
)
inherited

Emits the most recently emitted item (if any) emitted by the source Stream since the previous emission within the recurring time span, defined by duration

Example

new Stream.fromIterable([1, 2, 3])
  .sampleTime(const Duration(seconds: 1))
  .listen(print); // prints 3

Implementation

Observable<T> sampleTime(Duration duration) =>
    sample(Stream<void>.periodic(duration));