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

toRequestOption not define #114

Closed hew999 closed 1 year ago

hew999 commented 1 year ago

I just want to cache specific api end point, however i didnot find out the to request options override method

llfbandit commented 1 year ago

toOptions ?

await dio.get('https://www.foo.com',
  options: options.copyWith(policy: CachePolicy.request).toOptions(),
);
hew999 commented 1 year ago

@llfbandit
I want to add specific url cached

_dio.addInterceptor(InterceptorsWrapper(
    onRequest: (options, handler) {
      if (options.uri.toString().contains('some_endpoint')) {
        return handler.next(cachedOptions.toOptions()) **<-----** why i cant use the to request option
      }
      return handler.next(options);
    },
  )

No .toReuestOption() methid to call

llfbandit commented 1 year ago

https://github.com/llfbandit/dio_cache_interceptor/wiki/Handling-cache-with-client-only has been updated to reflect the right process.