DeduplicateInterceptor class

author:郑再红 email:1096877329@qq.com date:2026-08-07 9:42 describe:请求去重拦截器 对相同路径+参数的并发请求进行去重,避免重复发起相同请求。 适用于用户快速点击按钮等场景。

Inheritance

Constructors

DeduplicateInterceptor({Duration duration = const Duration(seconds: 3), String keyBuilder(AdapterRequest request)?})

Properties

duration Duration
去重时间窗口,默认 3 秒
final
hashCode int
The hash code for this object.
no setterinherited
keyBuilder String Function(AdapterRequest request)?
自定义去重 key 生成器
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearAll() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(AdapterException error, ErrorInterceptorHandler handler) → void
错误拦截
override
onRequest(AdapterRequest request, RequestInterceptorHandler handler) → void
请求拦截
override
onResponse(AdapterResponse response, ResponseInterceptorHandler handler) → void
响应拦截
override
toString() String
A string representation of this object.
inherited

Operators

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