Stored<T> class

A cached value with its associated metadata.

Stored wraps a cached value of type T along with Metadata that tracks versioning, TTL, and HTTP caching information.

This class is used internally by Store implementations and is returned when reading from the cache.

Example:

final stored = Stored<User>(
  value: user,
  meta: Metadata(
    version: 1,
    storedAt: DateTime.now(),
    ttl: Duration(minutes: 5),
  ),
);

print(stored.value.name);
print(stored.meta.isExpired);

Constructors

Stored({required T value, required Metadata meta})
Creates a Stored instance with the given value and meta.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
meta → Metadata
Metadata associated with this cached entry.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
value → T
The cached value.
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