AsyncObservable<T> class

A reactive wrapper for managing asynchronous operations and their states.

Mixed-in types

Constructors

AsyncObservable.new()

Properties

data → T?
Current data if the async operation succeeded.
no setter
error String?
Current error message if the async operation failed.
no setter
hasData bool
Whether data is available.
no setter
hasError bool
Whether an error has occurred.
no setter
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether this object has been disposed.
no setterinherited
isLoading bool
Whether the operation is currently loading.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state AsyncState
Current async state (idle, loading, success, error).
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
dispose() → void
Disposes all underlying observables.
override
execute(Future<T> operation()) Future<void>
Executes an asynchronous operation and updates the state accordingly.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets the observable to initial idle state.
setData(T data) → void
Sets the value manually and marks state as successful.
setDebounceTimer(Timer timer) → void
Set or update the debounce timer.
inherited
setError(String error) → void
Sets the error message manually and marks state as error.
throwIfDisposed([String? operation]) → void
Throw if this object has been disposed.
inherited
toString() String
A string representation of this object.
inherited
watchData() → T?
Watches and returns the data reactively.
watchError() String?
Watches and returns the error reactively.
watchLoading() bool
Watches and returns whether it's currently loading.
watchState() AsyncState
Watches and returns the current async state reactively.

Operators

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