RequestContext class

请求上下文

承载单次请求的完整上下文信息,包括配置、状态和临时数据。

Constructors

RequestContext({required String clientKey, required SmartRequest request, List<SmartPlugin> extraPlugins = const [], Set<Type> excludePlugins = const {}, Map<Type, Set<LifecycleHook>>? skipHooks, Set<String>? consumedErrorCodes, BaseOptions? optionsOverride, Map<String, dynamic>? extras})

Properties

clientKey → String
客户端 key
final
consumedErrorCodes → Set<String>
已消费错误码集合(用于避免 onError 重复处理)
final
duration → int?
请求耗时(毫秒)
no setter
endTime ↔ DateTime?
请求结束时间
getter/setter pair
error ↔ Object?
错误信息(执行后填充)
getter/setter pair
excludePlugins → Set<Type>
单次请求排除的插件类型(热拔)
final
extraPlugins → List<SmartPlugin>
单次请求额外的插件列表(热插)
final
extras → Map<String, dynamic>
临时数据存储(供插件间传递)
final
hashCode → int
The hash code for this object.
no setterinherited
optionsOverride → BaseOptions?
单次请求覆盖的选项
final
request → SmartRequest
请求信息
final
response ↔ Response?
响应结果(执行后填充)
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
skipHooks → Map<Type, Set<LifecycleHook>>
跳过特定插件的特定生命周期钩子
final
startTime ↔ DateTime?
请求开始时间
getter/setter pair

Methods

consumeErrorCode(String code) → bool
标记错误码已消费,返回是否首次标记成功。
extractErrorCode(SmartError error) → String?
从 SmartError 提取统一错误码。
isErrorCodeConsumed(String code) → bool
判断错误码是否已消费。
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