SmartRequest class
请求 DTO
Constructors
-
SmartRequest({required String path, String method = 'GET', dynamic data, Map<
String, dynamic> ? queryParameters, Map<String, String> ? headers, Duration? timeout, CancelToken? cancelToken, bool isFormData = false}) -
const
-
SmartRequest.get(String path, {Map<
String, dynamic> ? queryParameters, Map<String, String> ? headers, CancelToken? cancelToken}) -
创建 GET 请求
factory
-
SmartRequest.post(String path, {dynamic data, Map<
String, dynamic> ? queryParameters, Map<String, String> ? headers, CancelToken? cancelToken, bool isFormData = false}) -
创建 POST 请求
factory
Properties
- cancelToken → CancelToken?
-
取消令牌
final
- data → dynamic
-
请求数据(POST/PUT 的 body)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> ? -
请求头
final
- isFormData → bool
-
是否是 FormData
final
- method → String
-
请求方法(GET, POST, PUT, DELETE, PATCH)
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