StreamObservable<T> class

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

Integrates with the Observable system in Minix to automatically track:

  • Current stream value
  • Stream state (idle, listening, paused, closed, error)
  • Errors
  • Whether data has been received

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
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

cancel() Future<void>
Cancels the current stream subscription.
dispose() Future<void>
Disposes all internal observables and cancels any active stream.
listen(Stream<T> stream, {void onData(T data)?, void onError(String error)?, void 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 mapper.
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.
setError(String error) → void
Manually sets the error message and state to StreamState.error.
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