OnRefreshFailedCallback typedef
OnRefreshFailedCallback =
void Function(dynamic error)
A callback invoked when the refresh flow fails.
This function is called when OnRefreshCallback throws during token refresh. It receives the thrown error object so callers can log, report, or trigger side effects such as logging out the current user.
The interceptor still forwards the original request error after invoking this callback, so this hook is intended for side effects rather than recovery.
Example:
void onRefreshFailed(dynamic error) {
debugPrint('Token refresh failed: $error');
// Optionally clear session or navigate to login.
}
Implementation
typedef OnRefreshFailedCallback = void Function(dynamic error);