dio_refresh 1.2.0
dio_refresh: ^1.2.0 copied to clipboard
A flutter package for intercepting requests and automatically fetching refresh tokens on API failures
1.2.0 #
- Breaking: Removed time-based refresh throttling and the
throttleDurationoption added in 1.1.0. Upgrade by deleting anythrottleDurationargument from your setup. - Refresh is serialized with an in-flight
Future(_refreshFuture): the first failure startsonRefresh; any other concurrentonErrorhandlers await that same future instead of starting another refresh. - Outgoing requests wait their turn:
onRequestawaits_refreshFuturebefore applyingauthHeader, so new calls do not attach a stale token while a refresh is still running. - After the shared refresh completes,
_refreshFutureis cleared so a later auth failure can start a new refresh cycle.
1.1.0 #
- Fixed
onRefreshbeing called multiple times simultaneously, resulting in future API failure - Added configurable
throttleDurationto control token refresh throttling window (default:800ms)
1.0.8 #
- Fixed
Bad state: handler already callederror when token refresh fails — handler was being called twice due to fall-through after the synchronized block
1.0.7 #
- Added support for providing an
OnRefreshFailedCallbackto handle refresh failures
1.0.6 #
- Fix: Refresh is now triggered when either the server requests it (shouldRefresh) or the token is locally expired. Previously both conditions were required, causing refresh to be skipped in revoked-token scenarios
1.0.5 #
- Added retry interceptors
1.0.4 #
- Fixed form data being submitted twice error on request retry
- Added custom token validation callback
1.0.3 #
- Fixed error handling for
isRefreshingdeadlock - Fixed
onRefreshbeing called multiple times simultaneously
1.0.2 #
- Fixed refresh being called even if token is null
- Fixed isRefreshing deadlock, causing APIs to never resolve
1.0.1 #
- Fixed changelog
1.0.0 #
- Fixed bulk API call handling to prevent failures.
0.0.1 #
- Initial release.