DataState<T> class
final
Immutable snapshot of one key of a ReactiveDataManager (or of a
ReactiveValue): the value together with its loading, error and freshness
flags. It uses the vocabulary of PagedState: the previous data is kept
while a fetch runs and after a fetch fails, and errors live here, never as
stream errors.
Has value equality (data is compared with ==), so distinct() and
widget rebuild checks work; watchState never emits a state equal to the
previous one.
Constructors
Properties
- data → T?
-
The cached value;
nullwhen there is none (see hasData).final - error → Object?
-
The last failure (of a fetch or an
updateData), aftererrorMapper. Cleared when the next fetch starts or a new value is written.final - fetchedAt → DateTime?
-
When data was fetched (or last written).
final
- hasData → bool
-
Whether a value is cached. Tells "no value yet" from a
nullvalue.final - hasError → bool
-
Whether the last fetch or update failed.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isLoading → bool
-
A fetch is in flight (or the persisted value is still being read). The
previous data stays visible.
final
- isLoadingInitial → bool
-
The very first fetch is in flight: no data yet.
no setter
- isStale → bool
-
data was invalidated or is older than
maxAge(evaluated when the state was emitted). Alwaysfalsewithout data.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
Where error was thrown.
final
Methods
-
errorAs<
E> () → E? -
error as an
E, ornullwhen it is something else (or absent). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override