WindowStreamTransformer<T> class

Creates an Observable where each item is a Stream containing the items from the source sequence, batched by the sampler.

Example with onCount

Observable.range(1, 4)
  .window(onCount(2))
  .doOnData((_) => print('next window'))
  .flatMap((s) => s)
  .listen(print); // prints next window 1, 2, next window 3, 4

Example with onFuture

new Observable.periodic(const Duration(milliseconds: 100), (int i) => i)
  .window(onFuture(() => new Future.delayed(const Duration(milliseconds: 220))))
  .doOnData((_) => print('next window'))
  .flatMap((s) => s)
  .listen(print); // prints next window 0, 1, next window 2, 3, ...

Example with onTest

new Observable.periodic(const Duration(milliseconds: 100), (int i) => i)
  .window(onTest((i) => i % 2 == 0))
  .doOnData((_) => print('next window'))
  .flatMap((s) => s)
  .listen(print); // prints next window 0, next window 1, 2 next window 3, 4,  ...

Example with onTime

new Observable.periodic(const Duration(milliseconds: 100), (int i) => i)
  .window(onTime(const Duration(milliseconds: 220)))
  .doOnData((_) => print('next window'))
  .flatMap((s) => s)
  .listen(print); // prints next window 0, 1, next window 2, 3, ...

Example with onStream

new Observable.periodic(const Duration(milliseconds: 100), (int i) => i)
  .window(onStream(new Stream.periodic(const Duration(milliseconds: 220), (int i) => i)))
  .doOnData((_) => print('next window'))
  .flatMap((s) => s)
  .listen(print); // prints next window 0, 1, next window 2, 3, ...

You can create your own sampler by extending StreamView should the above samplers be insufficient for your use case.

Inheritance

Constructors

WindowStreamTransformer(SamplerBuilder<T, Stream<T>> sampler, { bool exhaustBufferOnDone: true })

Properties

exhaustBufferOnDone bool
final
sampler SamplerBuilder<T, Stream<T>>
final
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

bind(Stream<T> stream) Stream<Stream<T>>
Transforms the provided stream. [...]
override
cast<RS, RT>() StreamTransformer<RS, RT>
Provides a StreamTransformer<RS, RT> view of this stream transformer. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited

Static Methods

assertSampler<T>(SamplerBuilder<T, Stream<T>> scheduler) → void