dio-http-cache icon indicating copy to clipboard operation
dio-http-cache copied to clipboard

Make DioCacheManager._buildResponse() non-private

Open slavap opened this issue 4 years ago • 4 comments
trafficstars

@hurshi After accepting https://github.com/hurshi/dio-http-cache/pull/84

Please add the following minor changes:

Make DioCacheManager._buildResponse() non-private and async (make it protected), with changed to RequestInterceptorHandler it is currently too hard to adjust cached data additionally in DioCacheManager descendants.

@protected
Future<Response> buildResponse(CacheObj obj, int statusCode, RequestOptions options) async {
}

And add await in two places of DioCacheManager where buildResponse() called.

It is proper change for new handler based structure. Example: there are some data in cache and they are still valid, but some headers and cookies are changed, so I need just slightly adjust Response without discarding the cache. So I have descendant which manages this after data returned from the cache.

slavap avatar Mar 25 '21 10:03 slavap

Thanks for your commit, I will review this change on a non-working day, please be patient.

franticn avatar Apr 02 '21 07:04 franticn

@slavap After reviewing your change, I found that we need to upgrade to Dio 4 to support these, so the feature for support flutter 2.0 and null-safety maybe need to be advanced in advance.

franticn avatar Apr 04 '21 06:04 franticn

@franticn yes, that’s what I said in the opening description, Dio 4 and null safety PR must be accepted first.

slavap avatar Apr 04 '21 20:04 slavap

@franticn Please add this change, needed PR in already merged.

slavap avatar Apr 22 '21 02:04 slavap