ResourceSnapshot<T> class

Immutable snapshot of an API-backed resource.

Constructors

ResourceSnapshot({ResourceStatus status = ResourceStatus.idle, T? data, Object? error, DateTime? updatedAt})
Creates a resource snapshot.
const

Properties

data → T?
Current data, when available.
final
error Object?
Current error, when the latest request failed.
final
hasData bool
Whether data is not null.
no setter
hashCode int
The hash code for this object.
no setterinherited
isError bool
Whether the most recent request failed.
no setter
isIdle bool
Whether no request has been made yet.
no setter
isLoading bool
Whether a request is currently running.
no setter
isSuccess bool
Whether data is available from a successful request or server props.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status ResourceStatus
Current lifecycle status.
final
updatedAt DateTime?
Last time data or an error was written.
final

Methods

copyWith({ResourceStatus? status, T? data, Object? error, DateTime? updatedAt, bool clearError = false}) ResourceSnapshot<T>
Creates a modified snapshot.
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