StreamX<T> extension
General-purpose utility extension on Stream providing enhanced filtering, timing controls (like debounce/throttle), error handling, and scanning operators.
- on
-
- Stream<
T>
- Stream<
Properties
-
indexed
→ Stream<
(int, T)> -
Available on Stream<
EmitsT> , provided by the StreamX extension(index, value)pairs — likeenumeratein Python.no setter -
pairwise
→ Stream<
(T, T)> -
Available on Stream<
Pairs each event with the previous one asT> , provided by the StreamX extension(previous, current). Skips the first event (no previous exists).no setter
Methods
-
debounce(
Duration duration) → Stream< T> -
Available on Stream<
Suppresses events that arrive withinT> , provided by the StreamX extensiondurationof each other, emitting only the last one in each quiet window (debounce). -
distinctUntilChanged(
[bool equals(T, T)?]) → Stream< T> -
Available on Stream<
Emits only values that differ from the previous emission. Optionally compare by a derivedT> , provided by the StreamX extensionkeyinstead of the value itself. -
lastOrNull(
) → Future< T?> -
Available on Stream<
Emits the stream's last value as a Future, orT> , provided by the StreamX extensionorElseif the stream closes empty. -
onErrorReturn(
T fallback) → Stream< T> -
Available on Stream<
Recovers from errors by emittingT> , provided by the StreamX extensionfallback. -
onErrorReturnWith(
T recover(Object error)) → Stream< T> -
Available on Stream<
Recovers from errors by emitting the result ofT> , provided by the StreamX extensionrecover. -
scan<
S> (S seed, S accumulate(S acc, T value)) → Stream< S> -
Available on Stream<
Accumulates state across events usingT> , provided by the StreamX extensionseedandaccumulate. -
skipUntil(
bool predicate(T)) → Stream< T> -
Available on Stream<
Discards events untilT> , provided by the StreamX extensionpredicatereturnstrue, then emits all subsequent ones. -
takeWhileInclusive(
bool predicate(T)) → Stream< T> -
Available on Stream<
Emits events only whileT> , provided by the StreamX extensionpredicateholds; closes the stream on first failure. -
throttle(
Duration duration) → Stream< T> -
Available on Stream<
Emits the first event of eachT> , provided by the StreamX extensiondurationwindow and suppresses the rest (throttle). -
whereNotNull<
R extends Object> () → Stream< R> -
Available on Stream<
Emits only non-null values, narrowing the type toT> , provided by the StreamX extensionR.