llfbandit / dio_cache_interceptor

Dio HTTP cache interceptor with multiple stores respecting HTTP directives (ETag, Last-Modified, Cache-Control) with options.
https://pub.dev/packages/dio_cache_interceptor
120 stars 70 forks source link

how to use forceRefresh like Get data from network first If getting data from network succeeds, store or refresh cacheIf getting data from network fails or no network avaliable, try get data from cache instead of an error. #129

Closed YounesKHENIFER closed 1 year ago

YounesKHENIFER commented 1 year ago

i wonder how to use forceRefresh like

Get data from network first. If getting data from network succeeds, store or refresh cache. If getting data from network fails or no network avaliable, try get data from cache instead of an error.

i tried CachePolicy.refreshForceCache and CachePolicy.refresh not working form me and not using the cache if there is network issue

llfbandit commented 1 year ago

Use hitCacheOnErrorExcept to handle network failures.

YounesKHENIFER commented 1 year ago

hitCacheOnErrorExcept

thanks i have added 304 and its working !