SmartRequest<T> class

请求 DTO

Constructors

SmartRequest({required String path, HttpMethod method = HttpMethod.get, dynamic data, Map<String, dynamic>? queryParameters, Map<String, String>? headers, Duration? timeout, CancelToken? cancelToken, bool isFormData = false, JsonDecoder<T>? fromJson, BytesDecoder<T>? fromBytes, RawResponseDecoder<T>? fromResponse})
const
SmartRequest.get(String path, {Map<String, dynamic>? queryParameters, Map<String, String>? headers, CancelToken? cancelToken, JsonDecoder<T>? fromJson, BytesDecoder<T>? fromBytes, RawResponseDecoder<T>? fromResponse})
创建 GET 请求
factory
SmartRequest.post(String path, {dynamic data, Map<String, dynamic>? queryParameters, Map<String, String>? headers, CancelToken? cancelToken, bool isFormData = false, JsonDecoder<T>? fromJson, BytesDecoder<T>? fromBytes, RawResponseDecoder<T>? fromResponse})
创建 POST 请求
factory

Properties

cancelToken → CancelToken?
取消令牌
final
data → dynamic
请求数据(POST/PUT 的 body)
final
fromBytes → BytesDecoder<T>?
字节流解析器(用于 Protobuf 等二进制协议)
final
fromJson → JsonDecoder<T>?
JSON 解析器(用于解析预处理后的 data 或原始 JSON)
final
fromResponse → RawResponseDecoder<T>?
原始响应解析器(完全自定义解析逻辑)
final
hashCode → int
The hash code for this object.
no setterinherited
headers → Map<String, String>?
请求头
final
isFormData → bool
是否是 FormData
final
method → HttpMethod
请求方法
final
path → String
请求路径
final
queryParameters → Map<String, dynamic>?
查询参数
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timeout → Duration?
超时时间(覆盖全局配置)
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