core/network_strategy library
Strategies that control how NetworkManager resolves a request.
Each strategy defines the priority between network and cache, allowing fine-grained control over data freshness vs. offline resilience.
Classes
- CacheFirst
- Check the cache first. If a valid (non-expired) entry exists, return it immediately. Otherwise, execute the network request and cache the result.
- CacheOnly
- Only read from the cache — never touch the network.
- NetworkFirst
-
Try the network first. If it fails (timeout, no connectivity, server error),
fall back to cached data when a
cacheKeyis provided. - NetworkOnly
- Only use the network — never read or write the cache.
- NetworkStrategy
- Base class for network resolution strategies.