WithLatestFromStreamTransformer<S, T, R> class

A StreamTransformer that emits when the source stream emits, combining the latest values from the two streams using the provided function.

If the latestFromStream has not emitted any values, this stream will not emit either.

Interactive marble diagram

Example

Stream.fromIterable([1, 2]).transform(
  WithLatestFromStreamTransformer(
    Stream.fromIterable([2, 3]), (a, b) => a + b)
  .listen(print); // prints 4 (due to the async nature of streams)
Inheritance

Constructors

WithLatestFromStreamTransformer(Iterable<Stream<T>> latestFromStreams, R combiner(S t, List<T> values))
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from latestFromStreams using the provided function fn.

Properties

combiner → R Function(S t, List<T> values)
The combiner Function
final
hashCode int
The hash code for this object.
no setterinherited
latestFromStreams Iterable<Stream<T>>
A collection of Streams of which the latest values will be combined.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bind(Stream<S> stream) Stream<R>
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 nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

with1<T, S, R>(Stream<S> latestFromStream, R fn(T t, S s)) WithLatestFromStreamTransformer<T, S, R>
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from latestFromStream using the provided function fn.
with2<T, A, B, R>(Stream<A> latestFromStream1, Stream<B> latestFromStream2, R fn(T t, A a, B b)) WithLatestFromStreamTransformer<T, dynamic, R>
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from all latestFromStreams using the provided function fn.
with3<T, A, B, C, R>(Stream<A> latestFromStream1, Stream<B> latestFromStream2, Stream<C> latestFromStream3, R fn(T t, A a, B b, C c)) WithLatestFromStreamTransformer<T, dynamic, R>
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from all latestFromStreams using the provided function fn.
with4<T, A, B, C, D, R>(Stream<A> latestFromStream1, Stream<B> latestFromStream2, Stream<C> latestFromStream3, Stream<D> latestFromStream4, R fn(T t, A a, B b, C c, D d)) WithLatestFromStreamTransformer<T, dynamic, R>
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from all latestFromStreams using the provided function fn.
with5<T, A, B, C, D, E, R>(Stream<A> latestFromStream1, Stream<B> latestFromStream2, Stream<C> latestFromStream3, Stream<D> latestFromStream4, Stream<E> latestFromStream5, R fn(T t, A a, B b, C c, D d, E e)) WithLatestFromStreamTransformer<T, dynamic, R>
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from all latestFromStreams using the provided function fn.
with6<T, A, B, C, D, E, F, R>(Stream<A> latestFromStream1, Stream<B> latestFromStream2, Stream<C> latestFromStream3, Stream<D> latestFromStream4, Stream<E> latestFromStream5, Stream<F> latestFromStream6, R fn(T t, A a, B b, C c, D d, E e, F f)) WithLatestFromStreamTransformer<T, dynamic, R>
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from all latestFromStreams using the provided function fn.
with7<T, A, B, C, D, E, F, G, R>(Stream<A> latestFromStream1, Stream<B> latestFromStream2, Stream<C> latestFromStream3, Stream<D> latestFromStream4, Stream<E> latestFromStream5, Stream<F> latestFromStream6, Stream<G> latestFromStream7, R fn(T t, A a, B b, C c, D d, E e, F f, G g)) WithLatestFromStreamTransformer<T, dynamic, R>
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from all latestFromStreams using the provided function fn.
with8<T, A, B, C, D, E, F, G, H, R>(Stream<A> latestFromStream1, Stream<B> latestFromStream2, Stream<C> latestFromStream3, Stream<D> latestFromStream4, Stream<E> latestFromStream5, Stream<F> latestFromStream6, Stream<G> latestFromStream7, Stream<H> latestFromStream8, R fn(T t, A a, B b, C c, D d, E e, F f, G g, H h)) WithLatestFromStreamTransformer<T, dynamic, R>
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from all latestFromStreams using the provided function fn.
with9<T, A, B, C, D, E, F, G, H, I, R>(Stream<A> latestFromStream1, Stream<B> latestFromStream2, Stream<C> latestFromStream3, Stream<D> latestFromStream4, Stream<E> latestFromStream5, Stream<F> latestFromStream6, Stream<G> latestFromStream7, Stream<H> latestFromStream8, Stream<I> latestFromStream9, R fn(T t, A a, B b, C c, D d, E e, F f, G g, H h, I i)) WithLatestFromStreamTransformer<T, dynamic, R>
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from all latestFromStreams using the provided function fn.
withList<T>(Iterable<Stream<T>> latestFromStreams) WithLatestFromStreamTransformer<T, T, List<T>>
Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from latestFromStreams using a List.