XAsyncState<T> class
An immutable, state-management agnostic representation of asynchronous data.
Store this value in setState, BLoC, Provider, Riverpod, GetX, MobX, or any
other state container, then pass it to XAsyncView.
Constructors
- XAsyncState.data(T data)
-
Creates a successfully loaded state.
const
- XAsyncState.empty()
-
Creates a successful state that contains no data.
const
- XAsyncState.error(Object error, [StackTrace? stackTrace])
-
Creates a failed state with its original error information.
const
- XAsyncState.initial()
-
Creates a state before any work has started.
const
- XAsyncState.loading({T? previousData})
-
Creates an in-progress state, optionally preserving previous data.
const
Properties
- data → T?
-
Loaded or previously loaded data.
final
- error → Object?
-
Error associated with XAsyncStatus.error.
final
- hasData → bool
-
Whether this state contains successfully loaded data.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isLoading → bool
-
Whether this state is currently loading.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
Optional stack trace associated with error.
final
- status → XAsyncStatus
-
Current asynchronous lifecycle status.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited