StreamObservable<T> class

A reactive wrapper around Dart's Stream, enabling observable state, error handling, and reactive UI updates.

Mixed-in types

Constructors

StreamObservable.new()

Properties

data → T?
Most recent data emitted from the stream.
no setter
error String?
Latest error encountered, if any.
no setter
hasData bool
Whether any data has been emitted yet.
no setter
hasError bool
Whether an error occurred.
no setter
hashCode int
The hash code for this object.
no setterinherited
isClosed bool
Whether the stream has been closed.
no setter
isDisposed bool
Whether this object has been disposed.
no setterinherited
isListening bool
Whether the stream is currently listening.
no setter
isPaused bool
Whether the stream is currently paused.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state StreamState
Current stream state.
no setter

Methods

addDisposeCallback(VoidCallback callback) → void
Add a callback to be executed during disposal.
inherited
addSubscription(StreamSubscription subscription) → void
Add a stream subscription to be cancelled during disposal.
inherited
cancel() Future<void>
Cancels the current stream subscription.
dispose() → void
Disposes all internal observables and cancels any active stream.
override
listen(Stream<T> stream, {void onData(T data)?, void onError(String error)?, VoidCallback? onDone, bool cancelOnError = false}) → void
Starts listening to a given stream and updates state/data accordingly.
map<R>(R mapper(T data)) StreamObservable<R>
Transforms the stream using a mapping function.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → void
Pauses the active stream if it's currently listening.
reset() → void
Resets the stream observable to idle state.
resume() → void
Resumes the paused stream.
setData(T data) → void
Manually sets the data value.
setDebounceTimer(Timer timer) → void
Set or update the debounce timer.
inherited
setError(String error) → void
Manually sets the error message and state to StreamState.error.
throwIfDisposed([String? operation]) → void
Throw if this object has been disposed.
inherited
toString() String
A string representation of this object.
inherited
watchData() → T?
Reactively watches the current stream data.
watchError() String?
Reactively watches the error.
watchHasData() bool
Reactively checks whether data has been received.
watchListening() bool
Reactively checks whether the stream is listening.
watchState() StreamState
Reactively watches the current StreamState.
where(bool predicate(T data)) StreamObservable<T>
Filters the stream using a predicate function.

Operators

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