RxFuture<T> class
A reactive wrapper for Future operations with state management
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
AsyncSnapshot< T> > - RxFuture
Constructors
-
RxFuture.new([Future<
T> ? initialFuture]) -
RxFuture.fromFactory(Future<
T> futureFactory()) - Create RxFuture with a factory function that can be refreshed
Properties
- data → T?
-
no setter
- error → Object?
-
no setter
- errorMessage → String?
-
Get error message as string
no setter
-
future
↔ Future<
T> ? -
Get the current future
getter/setter pair
- hasData → bool
-
no setter
- hasError → bool
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isLoading → bool
-
no setter
- originalError → Object?
-
Get the original error (unwrapped from RxException if applicable)
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- rxError → RxException?
-
Get error as RxException if available
no setter
- stackTrace → StackTrace?
-
no setter
-
value
↔ AsyncSnapshot<
T> -
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dataOr(
T fallback) → T - Get data with fallback
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
map<
R> (R mapper(T data)) → RxFuture< R> - Transform data if available
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
refresh(
) → void - Refresh the future - re-executes if factory is available, otherwise restarts current future
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setError(
Object error, [StackTrace? stackTrace]) → void - Manually set error state with enhanced error info
-
setFutureFactory(
Future< T> futureFactory()) → void - Set future from a factory function (enables refresh)
-
setLoading(
) → void - Manually set loading state
-
toString(
) → String -
A string representation of this object.
override
-
tryGetData(
) → RxResult< T> - Get data with error handling
-
tryRefresh(
) → RxResult< void> - Refresh with error handling
-
trySetData(
T data) → RxResult< void> - Manually set data state with error handling
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited