-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to nullsatefy and Dio 4 #84
Conversation
ping @hurshi. |
@erickok @protected
Future<Response> buildResponse(CacheObj obj, int statusCode, RequestOptions options) async {
} And add await in two places of DioCacheManager where buildResponse() called. |
@slavap I am not the maintainer of the library so I am not sure I want to introduce such changes in this PR. Maybe you can submit a separate PR instead (branched from this nullsafety PR)? Otherwise if you explain a bit more what you want to do, maybe there is a different way - the new handler-bsed interceptors are exactly build with a use-case in mind where you want to amend the default behaviour. |
@erickok 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 Fair enough but in the end it's not really my decision to make. |
@erickok As you see author of this repo is very slowly reacting. My change is absolutely minor and does not affect anything in existing codebase. But fits properly into new dio logic. |
@slavap I understand. Especially because the owner is so slow, I suggest you fork the library yourself, apply this pr and your preferred change, and just use that as ref in your flutter project dependencies. I don't think i can be of much help to you. |
@erickok ok, thanks. Of course I’m using my own version of this lib, but it is plainly wrong. |
…alled if from cache
Hey maintainer, merge this as soon as possible.
|
I do this while waiting @hurshi to review and merge it
|
Thanks, this is way better. I will use this syntax |
Hi @erickok is there a reason you made |
Hmm you might be right. I though it was a strict requirement (as there were non-null azssertions in |
Fixed - thanks for the feedback. |
@erickok Thank you very much for your PR. |
@slavap hey, is your change going to break the original stuff? Or is it necessary to add/change? Otherwise I will just make the dep link to @erickok 's fork version until this package is update, which I hope it will be out before the climate change take over the civilization... Ps, I don't directly use the package, just the package I have to use use this... and that package is outdated as well... and the updating work lead me to here... |
@SeasonLeee
|
@erickok you have to Otherwise, neither error happens or the request completes if maxStale is not expired and there is a prev success request. this happens when there is an error and the cache age is expired but now Bellow is my full
|
…gh the handler chain
@mozaffari Thank you for finding and reporting this! I updated my code |
@erickok @mozaffari Thanks for your pr. |
@@ -18,11 +18,11 @@ Options buildServiceCacheOptions( | |||
|
|||
/// build a normal cache options | |||
Options buildCacheOptions(Duration maxAge, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be Duration? maxAge
instead?
The documentation said
maxAge: set the cache time. If the value is null or not setted, it will try to get maxAge and maxStale from response headers.
It doesn't match the code anymore, and the code below is still checking ```if (null != maxAge)` { ... }``
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that sounds right. This PR is already merged though so you can create a new PR maybe, which makes the parameter nullable?
Following the same issue. |
Migrates to Dart 2.12 and enabled nullsafety. This also upgrades to Dio 4's new interceptors with handlers.
The example was updated for Android to use v3 embedding. Updated iOS example app Podfile.
--
Similar to #81 but compatible with Dio 4.