BehaviorSubject<T> class
A special StreamController that captures the latest item that has been added to the controller, and emits that as the first item to any new listener.
This subject allows sending data, error and done events to the listener. The latest item that has been added to the subject will be sent to any new listeners of the subject. After that, any new events will be appropriately sent to the listeners. It is possible to provide a seed value that will be emitted if no items have been added to the subject.
BehaviorSubject is, by default, a broadcast (aka hot) controller, in order
to fulfill the Rx Subject contract. This means the Subject's stream
can
be listened to multiple times.
Example
final subject = BehaviorSubject<int>();
subject.add(1);
subject.add(2);
subject.add(3);
subject.stream.listen(print); // prints 3
subject.stream.listen(print); // prints 3
subject.stream.listen(print); // prints 3
Example with seed value
final subject = BehaviorSubject<int>.seeded(1);
subject.stream.listen(print); // prints 1
subject.stream.listen(print); // prints 1
subject.stream.listen(print); // prints 1
- Inheritance
-
- Object
- Stream<
T> - StreamView<
T> - Subject<
T> - BehaviorSubject
- Implemented types
-
- ValueStream<
T>
- ValueStream<
- Available extensions
- AddNullSinkExtension
- AsVoidStreamExtension
- BufferExtensions
- CollectStreamExtension
- ConcatExtensions
- ConnectableStreamExtensions
- DebounceExtensions
- DebugStreamExtension
- DefaultIfEmptyExtension
- DelayExtension
- DelayWhenExtension
- DematerializeExtension
- DistinctByExtension
- DistinctUniqueByStreamExtension
- DistinctUniqueExtension
- DoExtensions
- DoneOnErrorStreamExtension
- DoOnStreamExtensions
- EndWithExtension
- EndWithManyExtension
- ErrorAndStackTraceValueStreamExtension
- ExhaustMapExtension
- FlatMapBatchesStreamExtension
- FlatMapExtension
- GroupByExtension
- IgnoreElementsExtension
- IgnoreErrorsStreamExtension
- IntervalExtension
- LastEventValueStreamExtensions
- MapNotNullExtension
- MapToExtension
- MaterializeExtension
- MaxExtension
- MergeExtension
- MinExtension
- OnErrorExtensions
- PairwiseExtension
- SampleExtensions
- ScanExtension
- SingleOrErrorStreamExtension
- SkipLastExtension
- SkipUntilExtension
- StartWithExtension
- StartWithManyExtension
- StateConnectableExtensions
- SwitchIfEmptyExtension
- SwitchMapExtension
- TakeLastExtension
- TakeUntilExtension
- TakeWhileInclusiveExtension
- ThrottleExtensions
- TimeIntervalExtension
- TimeStampExtension
- ToNotReplayValueStreamExtension
- ToSingleSubscriptionStreamExtension
- ToStateStreamExtension
- ValueConnectableNotReplayStreamExtensions
- WhereNotNullExtension
- WhereTypeExtension
- WindowExtensions
- WithLatestFromExtensions
- ZipWithExtension
Constructors
- BehaviorSubject({void onListen()?, void onCancel()?, bool sync = false})
-
Constructs a BehaviorSubject, optionally pass handlers for
onListen
,onCancel
and a flag to handle eventssync
.factory - BehaviorSubject.seeded(T seedValue, {void onListen()?, void onCancel()?, bool sync = false})
-
Constructs a BehaviorSubject, optionally pass handlers for
onListen
,onCancel
and a flag to handle eventssync
.factory
Properties
- done → Future
-
A future which is completed when the stream controller is done
sending events.
no setterinherited
- error → Object
-
Returns last emitted error, failing if there is no error.
See hasError to determine whether error has already been set.
no setteroverride
- errorAndStackTraceOrNull → ErrorAndStackTrace?
-
Available on ValueStream<
Returns the last emitted ErrorAndStackTrace, orT> , provided by the ErrorAndStackTraceValueStreamExtension extensionnull
if no error events have been emitted yet.no setter - errorOrNull → Object?
-
Returns the last emitted error, or
null
if error events haven't yet been emitted.no setteroverride -
first
→ Future<
T> -
The first element of this stream.
no setterinherited
- hasError → bool
-
Returns
true
when error is available, meaning this Stream has emitted at least one error.no setteroverride - hashCode → int
-
The hash code for this object.
no setterinherited
- hasListener → bool
-
Whether there is a subscriber on the Stream.
no setterinherited
- hasValue → bool
-
Returns
true
when value is available, meaning this Stream has emitted at least one value.no setteroverride - isBroadcast → bool
-
Whether this stream is a broadcast stream.
no setterinherited
- isClosed → bool
-
Whether the stream controller is closed for adding more events.
no setterinherited
-
isEmpty
→ Future<
bool> -
Whether this stream contains any elements.
no setterinherited
- isLastEventError → bool
-
Available on ValueStream<
ReturnsT> , provided by the LastEventValueStreamExtensions extensiontrue
if the last emitted event is an error event.no setter - isLastEventValue → bool
-
Available on ValueStream<
ReturnsT> , provided by the LastEventValueStreamExtensions extensiontrue
if the last emitted event is a data event (aka. a value event).no setter - isPaused → bool
-
Whether the subscription would need to buffer events.
no setterinherited
-
last
→ Future<
T> -
The last element of this stream.
no setterinherited
-
lastEventOrNull
→ StreamNotification<
T> ? -
Returns the last emitted event (either data/value or error event).
null
if no value or error events have been emitted yet.no setteroverride -
length
→ Future<
int> -
The number of elements in this stream.
no setterinherited
- onCancel ↔ ControllerCancelCallback?
-
The callback which is called when the stream is canceled.
getter/setter pairinherited
- onListen ↔ ControllerCallback?
-
The callback which is called when the stream is listened to.
getter/setter pairinherited
- onPause ↔ ControllerCallback
-
The callback which is called when the stream is paused.
getter/setter pairinherited
- onResume ↔ ControllerCallback
-
The callback which is called when the stream is resumed.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
single
→ Future<
T> -
The single element of this stream.
no setterinherited
-
sink
→ StreamSink<
T> -
Returns a view of this object that only exposes the StreamSink interface.
no setterinherited
- stackTrace → StackTrace?
-
Returns StackTrace of the last emitted error.
no setteroverride
-
stream
→ ValueStream<
T> -
The stream that this controller is controlling.
no setteroverride
- value ↔ T
-
Returns the last emitted value, failing if there is no value.
See hasValue to determine whether value has already been set.
getter/setter pairoverride-getter
- valueOrNull → T?
-
Returns the last emitted value, or
null
if value events haven't yet been emitted.no setteroverride
Methods
-
add(
T event) → void -
Sends a data
event
.inherited -
addError(
Object error, [StackTrace? stackTrace]) → void -
Sends or enqueues an error event.
inherited
-
addNull(
) → void -
Available on Sink<
Addvoid> , provided by the AddNullSinkExtension extensionnull
to this Sink. -
addStream(
Stream< T> source, {bool? cancelOnError}) → Future<void> -
Receives events from
source
and puts them into this controller's stream.inherited -
any(
bool test(T element)) → Future< bool> -
Checks whether
test
accepts any element provided by this stream.inherited -
asBroadcastStream(
{void onListen(StreamSubscription< T> subscription)?, void onCancel(StreamSubscription<T> subscription)?}) → Stream<T> -
Returns a multi-subscription stream that produces the same events as this.
inherited
-
asVoid(
) → Stream< void> -
Available on Stream<
Returns aT> , provided by the AsVoidStreamExtension extensionStream<void>
. -
asyncExpand<
E> (Stream< E> ? convert(T event)) → Stream<E> -
Transforms each element into a sequence of asynchronous events.
inherited
-
asyncMap<
E> (FutureOr< E> convert(T event)) → Stream<E> -
Creates a new stream with each data event of this stream asynchronously
mapped to a new event.
inherited
-
buffer(
Stream< void> window) → Stream<List< T> > -
Available on Stream<
Creates a Stream where each item is a List containing the items from the source sequence.T> , provided by the BufferExtensions extension -
bufferCount(
int count, [int startBufferEvery = 0]) → Stream< List< T> > -
Available on Stream<
Buffers a number of values from the source Stream byT> , provided by the BufferExtensions extensioncount
then emits the buffer and clears it, and starts a new buffer eachstartBufferEvery
values. IfstartBufferEvery
is not provided, then new buffers are started immediately at the start of the source and when each buffer closes and is emitted. -
bufferTest(
bool onTestHandler(T event)) → Stream< List< T> > -
Available on Stream<
Creates a Stream where each item is a List containing the items from the source sequence, batched whenever test passes.T> , provided by the BufferExtensions extension -
bufferTime(
Duration duration) → Stream< List< T> > -
Available on Stream<
Creates a Stream where each item is a List containing the items from the source sequence, sampled on a time frame withT> , provided by the BufferExtensions extensionduration
. -
cast<
R> () → Stream< R> -
Adapt this stream to be a
Stream<R>
.inherited -
close(
) → Future -
Closes the stream.
inherited
-
collect(
) → StreamSubscription< T> -
Available on Stream<
Listen without any handler.T> , provided by the CollectStreamExtension extension -
concatWith(
Iterable< Stream< other) → Stream<T> >T> -
Available on Stream<
Returns a Stream that emits all items from the current Stream, then emits all items from the given streams, one after the next.T> , provided by the ConcatExtensions extension -
contains(
Object? needle) → Future< bool> -
Returns whether
needle
occurs in the elements provided by this stream.inherited -
debounce(
Stream< void> window(T event)) → Stream<T> -
Available on Stream<
Transforms a Stream so that will only emit items from the source sequence if aT> , provided by the DebounceExtensions extensionwindow
has completed, without the source sequence emitting another item. -
debounceTime(
Duration duration) → Stream< T> -
Available on Stream<
Transforms a Stream so that will only emit items from the source sequence whenever the time span defined byT> , provided by the DebounceExtensions extensionduration
passes, without the source sequence emitting another item. -
debug(
{String? identifier, void log(String)? = print, bool trimOutput = false}) → Stream< T> -
Available on Stream<
RxDart debug operator - Port from RxSwift Debug OperatorT> , provided by the DebugStreamExtension extension -
defaultIfEmpty(
T defaultValue) → Stream< T> -
Available on Stream<
Emit items from the source Stream, or a single default item if the source Stream emits nothing.T> , provided by the DefaultIfEmptyExtension extension -
delay(
Duration duration) → Stream< T> -
Available on Stream<
The Delay operator modifies its source Stream by pausing for a particular increment of time (that you specify) before emitting each of the source Stream’s items. This has the effect of shifting the entire sequence of items emitted by the Stream forward in time by that specified increment.T> , provided by the DelayExtension extension -
delayWhen(
Stream< void> itemDelaySelector(T value), {Stream<void> ? listenDelay}) → Stream<T> -
Available on Stream<
Delays the emission of items from the source Stream by a given time span determined by the emissions of another Stream.T> , provided by the DelayWhenExtension extension -
dematerialize(
) → Stream< T> -
Available on Stream<
Converts the onData, onDone, and onError StreamNotification objects from a materialized stream into normal onData, onDone, and onError events.StreamNotification< , provided by the DematerializeExtension extensionT> > -
distinct(
[bool equals(T previous, T next)?]) → Stream< T> -
Skips data events if they are equal to the previous data event.
inherited
-
distinctBy<
R> (R keySelector(T), {Equality< R> ? equals}) → Stream<T> -
Available on Stream<
Skips data events if their key are equal to the key of the previous data event.T> , provided by the DistinctByExtension extension -
distinctUnique(
{bool equals(T e1, T e2)?, int hashCode(T e)?}) → Stream< T> -
Available on Stream<
WARNING: More commonly known as distinct in other Rx implementations. Creates a Stream where data events are skipped if they have already been emitted before.T> , provided by the DistinctUniqueExtension extension -
distinctUniqueBy<
R> (R keySelector(T), {Equality< R> ? equals, int hashCode(R e)?}) → Stream<T> -
Available on Stream<
WARNING: More commonly known as distinct in other Rx implementations.T> , provided by the DistinctUniqueByStreamExtension extension -
doneOnError(
[bool predicate(Object e, StackTrace s)?]) → Stream< T> -
Available on Stream<
Returns a Stream that emits done event on first error event. The error is included in the output of the returned Stream.T> , provided by the DoneOnErrorStreamExtension extension -
doOn(
{void listen()?, FutureOr< void> cancel()?, void pause()?, void resume()?, void data(T data)?, void error(Object error, StackTrace stackTrace)?, void done()?, void each(StreamNotification<T> notification)?}) → Stream<T> -
Available on Stream<
Invokes the given callback at the corresponding point the the stream lifecycle. For example, if you pass in an onDone callback, it will be invoked when the stream finishes emitting items.T> , provided by the DoOnStreamExtensions extension -
doOnCancel(
FutureOr< void> onCancel()) → Stream<T> -
Available on Stream<
Invokes the given callback function when the stream subscription is cancelled. Often called doOnUnsubscribe or doOnDispose in other implementations.T> , provided by the DoExtensions extension -
doOnData(
void onData(T event)) → Stream< T> -
Available on Stream<
Invokes the given callback function when the stream emits an item. In other implementations, this is called doOnNext.T> , provided by the DoExtensions extension -
doOnDone(
void onDone()) → Stream< T> -
Available on Stream<
Invokes the given callback function when the stream finishes emitting items. In other implementations, this is called doOnComplete(d).T> , provided by the DoExtensions extension -
doOnEach(
void onEach(StreamNotification< T> notification)) → Stream<T> -
Available on Stream<
Invokes the given callback function when the stream emits data, emits an error, or emits done. The callback receives a StreamNotification object.T> , provided by the DoExtensions extension -
doOnError(
void onError(Object, StackTrace)) → Stream< T> -
Available on Stream<
Invokes the given callback function when the stream emits an error.T> , provided by the DoExtensions extension -
doOnListen(
void onListen()) → Stream< T> -
Available on Stream<
Invokes the given callback function when the stream is first listened to.T> , provided by the DoExtensions extension -
doOnPause(
void onPause()) → Stream< T> -
Available on Stream<
Invokes the given callback function when the stream subscription is paused.T> , provided by the DoExtensions extension -
doOnResume(
void onResume()) → Stream< T> -
Available on Stream<
Invokes the given callback function when the stream subscription resumes receiving items.T> , provided by the DoExtensions extension -
drain<
E> ([E? futureValue]) → Future< E> -
Discards all data on this stream, but signals when it is done or an error
occurred.
inherited
-
elementAt(
int index) → Future< T> -
Returns the value of the
index
th data event of this stream.inherited -
endWith(
T endValue) → Stream< T> -
Available on Stream<
Appends a value to the source Stream before closing.T> , provided by the EndWithExtension extension -
endWithMany(
Iterable< T> endValues) → Stream<T> -
Available on Stream<
Appends a sequence of values as final events to the source Stream before closing.T> , provided by the EndWithManyExtension extension -
every(
bool test(T element)) → Future< bool> -
Checks whether
test
accepts all elements provided by this stream.inherited -
exhaustMap<
S> (Stream< S> mapper(T value)) → Stream<S> -
Available on Stream<
Converts items from the source stream into a Stream using a given mapper. It ignores all items from the source stream until the new stream completes.T> , provided by the ExhaustMapExtension extension -
expand<
S> (Iterable< S> convert(T element)) → Stream<S> -
Transforms each element of this stream into a sequence of elements.
inherited
-
firstWhere(
bool test(T element), {T orElse()?}) → Future< T> -
Finds the first element of this stream matching
test
.inherited -
flatMap<
S> (Stream< S> mapper(T value), {int? maxConcurrent}) → Stream<S> -
Available on Stream<
Converts each emitted item into a Stream using the given mapper function, while limiting the maximum number of concurrent subscriptions to these Streams. The newly created Stream will be be listened to and begin emitting items downstream.T> , provided by the FlatMapExtension extension -
flatMapBatches<
R> (Stream< R> transform(T value), int size) → Stream<List< R> > -
Available on Stream<
Convert each element to a Stream, then listen to at mostT> , provided by the FlatMapBatchesStreamExtension extensionsize
Stream at a time and outputs their results insize
-sized batches, while maintaining order within each batch — subsequent batches of Streams are only listened to when the batch before it successfully completes. Errors will be forwarded downstream. -
flatMapBatchesSingle<
R> (Single< R> transform(T value), int size) → Single<List< R> > -
Available on Stream<
Similar to flatMapBatches, but collect all output result batches into a List, and emit final result as a Single when source Stream emits done event.T> , provided by the FlatMapBatchesStreamExtension extension -
flatMapIterable<
S> (Stream< Iterable< mapper(T value), {int? maxConcurrent}) → Stream<S> >S> -
Available on Stream<
Converts each item into a Stream. The Stream must return an Iterable. Then, each item from the Iterable will be emitted one by one.T> , provided by the FlatMapExtension extension -
fold<
S> (S initialValue, S combine(S previous, T element)) → Future< S> -
Combines a sequence of values by repeatedly applying
combine
.inherited -
forEach(
void action(T element)) → Future< void> -
Executes
action
on each element of this stream.inherited -
groupBy<
K> (K grouper(T value), {Stream< void> durationSelector(GroupedStream<T, K> grouped)?}) → Stream<GroupedStream< T, K> > -
Available on Stream<
The GroupBy operator divides a Stream that emits items into a Stream that emits GroupedStream, each one of which emits some subset of the items from the original source Stream.T> , provided by the GroupByExtension extension -
handleError(
Function onError, {bool test(dynamic error)?}) → Stream< T> -
Creates a wrapper Stream that intercepts some errors from this stream.
inherited
-
ignoreElements(
) → Stream< Never> -
Available on Stream<
Creates a Stream where all emitted items are ignored, only the error / completed notifications are passedT> , provided by the IgnoreElementsExtension extension -
ignoreErrors(
) → Stream< T> -
Available on Stream<
Ignore all error events, forward only data and done event.T> , provided by the IgnoreErrorsStreamExtension extension -
interval(
Duration duration) → Stream< T> -
Available on Stream<
Creates a Stream that emits each item in the Stream after a given duration.T> , provided by the IntervalExtension extension -
join(
[String separator = ""]) → Future< String> -
Combines the string representation of elements into a single string.
inherited
-
lastWhere(
bool test(T element), {T orElse()?}) → Future< T> -
Finds the last element in this stream matching
test
.inherited -
listen(
void onData(T value)?, {Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription< T> -
Adds a subscription to this stream.
inherited
-
map<
S> (S convert(T event)) → Stream< S> -
Transforms each element of this stream into a new stream event.
inherited
-
mapNotNull<
R extends Object> (R? transform(T)) → Stream< R> -
Available on Stream<
Returns a Stream containing only the non-T> , provided by the MapNotNullExtension extensionnull
results of applying the giventransform
function to each element of this Stream. -
mapTo<
T> (T value) → Stream< T> -
Available on Stream<
Emits the given constant value on the output Stream every time the source Stream emits a value.S> , provided by the MapToExtension extension -
materialize(
) → Stream< StreamNotification< T> > -
Available on Stream<
Converts the onData, on Done, and onError events into StreamNotification objects that are passed into the downstream onData listener.T> , provided by the MaterializeExtension extension -
max(
[Comparator< T> ? comparator]) → Future<T> -
Available on Stream<
Converts a Stream into a Future that completes with the largest item emitted by the Stream.T> , provided by the MaxExtension extension -
mergeWith(
Iterable< Stream< streams) → Stream<T> >T> -
Available on Stream<
Combines the items emitted by multiple streams into a single stream of items. The items are emitted in the order they are emitted by their sources.T> , provided by the MergeExtension extension -
min(
[Comparator< T> ? comparator]) → Future<T> -
Available on Stream<
Converts a Stream into a Future that completes with the smallest item emitted by the Stream.T> , provided by the MinExtension extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onAdd(
T event) → void -
An extension point for sub-classes. Perform any side-effect / state
management you need to here, rather than overriding the
add
method directly.override -
onAddError(
Object error, [StackTrace? stackTrace]) → void -
An extension point for sub-classes. Perform any side-effect / state
management you need to here, rather than overriding the
add
method directly.override -
onErrorResume(
Stream< T> recoveryFn(Object error, StackTrace stackTrace)) → Stream<T> -
Available on Stream<
Intercepts error events and switches to a recovery stream created by the providedT> , provided by the OnErrorExtensions extensionrecoveryFn
. -
onErrorResumeNext(
Stream< T> recoveryStream) → Stream<T> -
Available on Stream<
Intercepts error events and switches to the given recovery stream in that caseT> , provided by the OnErrorExtensions extension -
onErrorReturn(
T returnValue) → Stream< T> -
Available on Stream<
Instructs a Stream to emit a particular item when it encounters an error, and then terminate normallyT> , provided by the OnErrorExtensions extension -
onErrorReturnWith(
T returnFn(Object error, StackTrace stackTrace)) → Stream< T> -
Available on Stream<
Instructs a Stream to emit a particular item created by theT> , provided by the OnErrorExtensions extensionreturnFn
when it encounters an error, and then terminate normally. -
pairwise(
) → Stream< List< T> > -
Available on Stream<
Emits the n-th and n-1th events as a pair. The first event won't be emitted until the second one arrives.T> , provided by the PairwiseExtension extension -
pipe(
StreamConsumer< T> streamConsumer) → Future -
Pipes the events of this stream into
streamConsumer
.inherited -
publish(
) → PublishConnectableStream< T> -
Available on Stream<
Convert the current Stream into a ConnectableStream that can be listened to multiple times. It will not begin emitting items from the original Stream until theT> , provided by the ConnectableStreamExtensions extensionconnect
method is invoked. -
publishReplay(
{int? maxSize}) → ReplayConnectableStream< T> -
Available on Stream<
Convert the current Stream into a ReplayConnectableStream that can be listened to multiple times. It will not begin emitting items from the original Stream until theT> , provided by the ConnectableStreamExtensions extensionconnect
method is invoked. -
publishState(
T seedValue, {Equality< T> ? equals, bool sync = true}) → StateConnectableStream<T> -
Available on Stream<
Convert the this Stream into a StateConnectableStream that can be listened to multiple times, providing an initial seeded value. It will not begin emitting items from the original Stream until theT> , provided by the StateConnectableExtensions extensionconnect
method is invoked. -
publishValue(
) → ValueConnectableStream< T> -
Available on Stream<
Convert the current Stream into a ValueConnectableStream that can be listened to multiple times. It will not begin emitting items from the original Stream until theT> , provided by the ConnectableStreamExtensions extensionconnect
method is invoked. -
publishValueNotReplay(
T seedValue, {bool sync = true}) → NotReplayValueConnectableStream< T> -
Available on Stream<
Convert the current Stream into a ConnectableStream that can be listened to multiple times. It will not begin emitting items from the original Stream until theT> , provided by the ValueConnectableNotReplayStreamExtensions extensionconnect
method is invoked. -
publishValueSeeded(
T seedValue) → ValueConnectableStream< T> -
Available on Stream<
Convert the current Stream into a ValueConnectableStream that can be listened to multiple times, providing an initial seeded value. It will not begin emitting items from the original Stream until theT> , provided by the ConnectableStreamExtensions extensionconnect
method is invoked. -
reduce(
T combine(T previous, T element)) → Future< T> -
Combines a sequence of values by repeatedly applying
combine
.inherited -
sample(
Stream sampleStream) → Stream< T> -
Available on Stream<
Emits the most recently emitted item (if any) emitted by the source Stream since the previous emission from theT> , provided by the SampleExtensions extensionsampleStream
. -
sampleTime(
Duration duration) → Stream< T> -
Available on Stream<
Emits the most recently emitted item (if any) emitted by the source Stream since the previous emission within the recurring time span, defined byT> , provided by the SampleExtensions extensionduration
-
scan<
S> (S accumulator(S accumulated, T value, int index), S seed) → Stream< S> -
Available on Stream<
Applies an accumulator function over a Stream sequence and returns each intermediate result. The seed value is used as the initial accumulator value.T> , provided by the ScanExtension extension -
Available on Stream<
Convert the current Stream into a new Stream that can be listened to multiple times. It will automatically begin emitting items when first listened to, and shut down when no listeners remain.T> , provided by the ConnectableStreamExtensions extension -
Available on Stream<
Convert the current Stream into a new ReplayStream that can be listened to multiple times. It will automatically begin emitting items when first listened to, and shut down when no listeners remain.T> , provided by the ConnectableStreamExtensions extension -
Available on Stream<
Convert the this Stream into a new StateStream that can be listened to multiple times, providing an initial value. It will automatically begin emitting items when first listened to, and shut down when no listeners remain.T> , provided by the StateConnectableExtensions extension -
Available on Stream<
Convert the current Stream into a new ValueStream that can be listened to multiple times. It will automatically begin emitting items when first listened to, and shut down when no listeners remain.T> , provided by the ConnectableStreamExtensions extension -
Available on Stream<
Convert the current Stream into a new Stream that can be listened to multiple times. It will automatically begin emitting items when first listened to, and shut down when no listeners remain.T> , provided by the ValueConnectableNotReplayStreamExtensions extension -
Available on Stream<
Convert the current Stream into a new ValueStream that can be listened to multiple times, providing an initial value. It will automatically begin emitting items when first listened to, and shut down when no listeners remain.T> , provided by the ConnectableStreamExtensions extension -
singleOrError(
) → Single< T> -
Available on Stream<
Converts this source Stream into a Single. If this source Stream is already a Single, it will be returned as-is.T> , provided by the SingleOrErrorStreamExtension extension -
singleWhere(
bool test(T element), {T orElse()?}) → Future< T> -
Finds the single element in this stream matching
test
.inherited -
skip(
int count) → Stream< T> -
Skips the first
count
data events from this stream.inherited -
skipLast(
int count) → Stream< T> -
Available on Stream<
Starts emitting every items except lastT> , provided by the SkipLastExtension extensioncount
items. This causes items to be delayed. -
skipUntil<
S> (Stream< S> otherStream) → Stream<T> -
Available on Stream<
Starts emitting items only after the given stream emits an item.T> , provided by the SkipUntilExtension extension -
skipWhile(
bool test(T element)) → Stream< T> -
Skip data events from this stream while they are matched by
test
.inherited -
startWith(
T startValue) → Stream< T> -
Available on Stream<
Prepends a value to the source Stream.T> , provided by the StartWithExtension extension -
startWithMany(
List< T> startValues) → Stream<T> -
Available on Stream<
Prepends a sequence of values to the source Stream.T> , provided by the StartWithManyExtension extension -
switchIfEmpty(
Stream< T> fallbackStream) → Stream<T> -
Available on Stream<
When the original Stream emits no items, this operator subscribes to the given fallback stream and emits items from that Stream instead.T> , provided by the SwitchIfEmptyExtension extension -
switchMap<
S> (Stream< S> mapper(T value)) → Stream<S> -
Available on Stream<
Converts each emitted item into a Stream using the given mapper function. The newly created Stream will be be listened to and begin emitting items, and any previously created Stream will stop emitting.T> , provided by the SwitchMapExtension extension -
take(
int count) → Stream< T> -
Provides at most the first
count
data events of this stream.inherited -
takeLast(
int count) → Stream< T> -
Available on Stream<
Emits only the finalT> , provided by the TakeLastExtension extensioncount
values emitted by the source Stream. -
takeUntil<
S> (Stream< S> otherStream) → Stream<T> -
Available on Stream<
Returns the values from the source Stream sequence until the other Stream sequence produces a value.T> , provided by the TakeUntilExtension extension -
takeWhile(
bool test(T element)) → Stream< T> -
Forwards data events while
test
is successful.inherited -
takeWhileInclusive(
bool test(T)) → Stream< T> -
Available on Stream<
Emits values emitted by the source Stream so long as each value satisfies the given test. When the test is not satisfied by a value, it will emit this value as a final event and then complete.T> , provided by the TakeWhileInclusiveExtension extension -
throttle(
Stream< void> window(T event), {bool trailing = false, bool leading = true}) → Stream<T> -
Available on Stream<
Emits a value from the source Stream, then ignores subsequent source values while the window Stream is open, then repeats this process.T> , provided by the ThrottleExtensions extension -
throttleTime(
Duration duration, {bool trailing = false, bool leading = true}) → Stream< T> -
Available on Stream<
Emits a value from the source Stream, then ignores subsequent source values for a duration, then repeats this process.T> , provided by the ThrottleExtensions extension -
timeInterval(
) → Stream< TimeInterval< T> > -
Available on Stream<
Records the time interval between consecutive values in a Stream sequence.T> , provided by the TimeIntervalExtension extension -
timeout(
Duration timeLimit, {void onTimeout(EventSink< T> sink)?}) → Stream<T> -
Creates a new stream with the same events as this stream.
inherited
-
timestamp(
) → Stream< Timestamped< T> > -
Available on Stream<
Wraps each item emitted by the source Stream in a Timestamped object that includes the emitted item and the time when the item was emitted.T> , provided by the TimeStampExtension extension -
toList(
) → Future< List< T> > -
Collects all elements of this stream in a List.
inherited
-
toNotReplayValueStream(
T value) → NotReplayValueStream< T> -
Available on Stream<
Convert this Stream to a single-subscription NotReplayValueStream.T> , provided by the ToNotReplayValueStreamExtension extension -
toSet(
) → Future< Set< T> > -
Collects the data of this stream in a Set.
inherited
-
toSingleSubscriptionStream(
) → Stream< T> -
Available on Stream<
Converts a broadcast Stream into a single-subscription Stream.T> , provided by the ToSingleSubscriptionStreamExtension extension -
toStateStream(
T value, {Equality< T> ? equals}) → StateStream<T> -
Available on Stream<
Convert this Stream to a StateStream.T> , provided by the ToStateStreamExtension extension -
toString(
) → String -
A string representation of this object.
inherited
-
transform<
S> (StreamTransformer< T, S> streamTransformer) → Stream<S> -
Applies
streamTransformer
to this stream.inherited -
where(
bool test(T event)) → Stream< T> -
Creates a new stream from this stream that discards some elements.
inherited
-
whereNotNull(
) → Stream< T> -
Available on Stream<
Returns a Stream which emits all the non-T?> , provided by the WhereNotNullExtension extensionnull
elements of this Stream, in their original emission order. -
whereType<
S> () → Stream< S> -
Available on Stream<
This transformer is a shorthand for Stream.where followed by Stream.cast.T> , provided by the WhereTypeExtension extension -
window(
Stream< void> window) → Stream<Stream< T> > -
Available on Stream<
Creates a Stream where each item is a Stream containing the items from the source sequence.T> , provided by the WindowExtensions extension -
windowCount(
int count, [int startBufferEvery = 0]) → Stream< Stream< T> > -
Available on Stream<
Buffers a number of values from the source Stream byT> , provided by the WindowExtensions extensioncount
then emits the buffer as a Stream and clears it, and starts a new buffer eachstartBufferEvery
values. IfstartBufferEvery
is not provided, then new buffers are started immediately at the start of the source and when each buffer closes and is emitted. -
windowTest(
bool onTestHandler(T event)) → Stream< Stream< T> > -
Available on Stream<
Creates a Stream where each item is a Stream containing the items from the source sequence, batched whenever test passes.T> , provided by the WindowExtensions extension -
windowTime(
Duration duration) → Stream< Stream< T> > -
Available on Stream<
Creates a Stream where each item is a Stream containing the items from the source sequence, sampled on a time frame withT> , provided by the WindowExtensions extensionduration
. -
withLatestFrom<
S, R> (Stream< S> latestFromStream, R fn(T t, S s)) → Stream<R> -
Available on Stream<
Creates a Stream that emits when the source stream emits, combining the latest values from the two streams using the provided function.T> , provided by the WithLatestFromExtensions extension -
withLatestFrom2<
A, B, R> (Stream< A> latestFromStream1, Stream<B> latestFromStream2, R fn(T t, A a, B b)) → Stream<R> -
Available on Stream<
Creates a Stream that emits when the source stream emits, combining the latest values from the three streams using the provided function.T> , provided by the WithLatestFromExtensions extension -
withLatestFrom3<
A, B, C, R> (Stream< A> latestFromStream1, Stream<B> latestFromStream2, Stream<C> latestFromStream3, R fn(T t, A a, B b, C c)) → Stream<R> -
Available on Stream<
Creates a Stream that emits when the source stream emits, combining the latest values from the four streams using the provided function.T> , provided by the WithLatestFromExtensions extension -
withLatestFrom4<
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)) → Stream<R> -
Available on Stream<
Creates a Stream that emits when the source stream emits, combining the latest values from the five streams using the provided function.T> , provided by the WithLatestFromExtensions extension -
withLatestFrom5<
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)) → Stream<R> -
Available on Stream<
Creates a Stream that emits when the source stream emits, combining the latest values from the six streams using the provided function.T> , provided by the WithLatestFromExtensions extension -
withLatestFrom6<
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)) → Stream<R> -
Available on Stream<
Creates a Stream that emits when the source stream emits, combining the latest values from the seven streams using the provided function.T> , provided by the WithLatestFromExtensions extension -
withLatestFrom7<
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)) → Stream<R> -
Available on Stream<
Creates a Stream that emits when the source stream emits, combining the latest values from the eight streams using the provided function.T> , provided by the WithLatestFromExtensions extension -
withLatestFrom8<
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)) → Stream<R> -
Available on Stream<
Creates a Stream that emits when the source stream emits, combining the latest values from the nine streams using the provided function.T> , provided by the WithLatestFromExtensions extension -
withLatestFrom9<
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)) → Stream<R> -
Available on Stream<
Creates a Stream that emits when the source stream emits, combining the latest values from the ten streams using the provided function.T> , provided by the WithLatestFromExtensions extension -
withLatestFromList(
Iterable< Stream< latestFromStreams) → Stream<T> >List< T> > -
Available on Stream<
Creates a Stream that emits when the source stream emits, combining the latest values from the streams into a list. This is helpful when you need to combine a dynamic number of Streams.T> , provided by the WithLatestFromExtensions extension -
zipWith<
S, R> (Stream< S> other, R zipper(T t, S s)) → Stream<R> -
Available on Stream<
Returns a Stream that combines the current stream together with another stream using a given zipper function.T> , provided by the ZipWithExtension extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited