UnauthorizedRetryConfig class

登录态失效后的「刷新 token + 自动重试原请求」策略(包内不写死任何业务码或路径)。

HttpConfig.unauthorizedRetry 启用。典型场景:HTTP 401,或 JSON code 命中 sessionExpiredBusinessCode(若配置)。

并发refreshAccessToken 可能被并行调用,应用侧须自行合并为单次刷新。

Constructors

UnauthorizedRetryConfig({required Future<bool> refreshAccessToken(), int? sessionExpiredBusinessCode, List<String> excludedPathPrefixes = const [], int maxRetries = 1, Future<void> onRefreshFailed()?})
const

Properties

excludedPathPrefixes List<String>
不触发刷新重试的 path 前缀;由调用方按自身路由约定填写(包内默认为空,不排除任何路径)。
final
hashCode int
The hash code for this object.
no setterinherited
maxRetries int
单次 HttpUtil.send 内最多额外重试次数(不含首次请求)。
final
onRefreshFailed Future<void> Function()?
refreshAccessToken 返回 false 时调用(抛错由外层 send 捕获为网络错误,不经过此处)。 调用后,同一次响应在 HttpUtil.send不会再触发 HttpConfig.on401Unauthorized 与全局 HttpConfig.onFailure (当响应仍为「未授权形态」时),避免与插件原有 401 处理重复。
final
refreshAccessToken Future<bool> Function()
执行刷新;返回 true 表示新凭据已就绪,下一次网络往返会使用新头(见 HttpConfig.dynamicHeaderBuilder)。
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionExpiredBusinessCode int?
视为「会话过期」、需要刷新后重试的业务码(与 HTTP 状态码独立,由 ResponseParser 写入 Response.errorCode)。
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited