CachePolicy enum

Controls how ApiExecutor.execute interacts with the cache.

Inheritance
Available extensions

Values

networkFirst → const CachePolicy

Try the network first; fall back to cache on failure. Default – always tries to return fresh data.

cacheFirst → const CachePolicy

Return cache immediately, then refresh in background. Best for perceived performance on list screens.

cacheOnly → const CachePolicy

Return cache only; never hit the network. Use for offline mode.

networkOnly → const CachePolicy

Always hit the network; never read or write cache. Use for real-time data.

cacheAndNetwork → const CachePolicy

Return cached data immediately AND emit fresh network data once available. Best UX for list screens (instant render + background refresh).

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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

Constants

values → const List<CachePolicy>
A constant List of the values in this enum, in order of their declaration.