AdapterResponse<T> class

author: ZhengZaiHong email:1096877329@qq.com date: 2026-04-21 16:04 describe: 统一的响应包装模型 屏蔽不同网络库的响应差异,提供统一的响应接口

Constructors

AdapterResponse({required int statusCode, String? statusMessage, T? data, required Map<String, List<String>> headers, required AdapterRequest request, bool isRedirect = false, String? redirectUrl, Map<String, dynamic> extra = const {}})
const

Properties

data → T?
响应数据
final
extra Map<String, dynamic>
额外信息
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, List<String>>
响应头
final
isRedirect bool
是否重定向
final
isSuccess bool
是否成功 (2xx)
no setter
redirectUrl String?
重定向 URL
final
request AdapterRequest
请求信息
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int
状态码
final
statusMessage String?
状态消息
final

Methods

copyWith({int? statusCode, String? statusMessage, T? data, Map<String, List<String>>? headers, AdapterRequest? request, bool? isRedirect, String? redirectUrl, Map<String, dynamic>? extra}) AdapterResponse<T>
复制并修改
getHeader(String name) String?
获取响应头值
getHeaders(String name) List<String>?
获取所有响应头值
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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