getCacheOptions static method

Future<CacheOptions> getCacheOptions()

Implementation

static Future<CacheOptions> getCacheOptions() async {
  var extCacheDirs = await getTemporaryDirectory();
  var cacheStore = FileCacheStore(extCacheDirs.path);
  return CacheOptions(
    store: cacheStore,
    policy: CachePolicy.refreshForceCache,
    maxStale: const Duration(minutes: 30),
    allowPostMethod: false,
    priority: CachePriority.normal,
    keyBuilder: (request) {
      var key = request.data.hashCode.toString();
      return key;
    },
  );
}