DelayWhenStreamTransformer<T> class
Delays the emission of items from the source Stream by a given time span determined by the emissions of another Stream.
Example
Stream.fromIterable([1, 2, 3])
.transform(DelayWhenStreamTransformer(
(i) => Rx.timer(null, Duration(seconds: i))))
.listen(print); // [after 1s] prints 1 [after 1s] prints 2 [after 1s] prints 3
Stream.fromIterable([1, 2, 3])
.transform(
DelayWhenStreamTransformer(
(i) => Rx.timer(null, Duration(seconds: i)),
listenDelay: Rx.timer(null, Duration(seconds: 2)),
),
)
.listen(print); // [after 3s] prints 1 [after 1s] prints 2 [after 1s] prints 3
- Inheritance
-
- Object
- StreamTransformerBase<
T, T> - DelayWhenStreamTransformer
Constructors
-
DelayWhenStreamTransformer(Stream<
void> itemDelaySelector(T value), {Stream<void> ? listenDelay}) - Constructs a StreamTransformer which delays the emission of items from the source Stream by a given time span determined by the emissions of another Stream.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
itemDelaySelector
→ Stream<
void> Function(T value) -
A function used to determine delay time span for each data event.
final
-
listenDelay
→ Stream<
void> ? -
When listenDelay emits its first data or done event, the source Stream is listen to.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
bind(
Stream< T> 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 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