FetchPolicy enum

FetchPolicy determines where the client may return a result from.

  • cacheFirst: return result from cache. Only fetch from network if cached result is not available.
  • cacheAndNetwork: return result from cache first (if it exists), then return network result once it's available.
  • cacheOnly: return result from cache if available, fail otherwise.
  • noCache: return result from network, fail if network call doesn't succeed, don't save to cache.
  • networkOnly: return result from network, fail if network call doesn't succeed, save to cache.

The default fetchPolicy for each method are:

These can be overriden at client construction time by passing a DefaultPolicies instance to defaultPolicies.

Inheritance

Constructors

FetchPolicy()
const

Values

cacheFirst → const FetchPolicy

Return result from cache. Only fetch from network if cached result is not available.

cacheAndNetwork → const FetchPolicy

Return result from cache first (if it exists), then return network result once it's available.

cacheOnly → const FetchPolicy

Return result from cache if available, fail otherwise.

noCache → const FetchPolicy

Return result from network, fail if network call doesn't succeed, don't save to cache.

networkOnly → const FetchPolicy

Return result from network, fail if network call doesn't succeed, save to cache.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
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<FetchPolicy>
A constant List of the values in this enum, in order of their declaration.