SmartResponse<T> class

响应包装类

Constructors

SmartResponse({T? data, Response? raw, dynamic parsedData, SmartError? error, dynamic code, String? message, String? customErrorMessage, String? successMessage})
const

Properties

code → dynamic
服务器返回的业务码(通过 ResponseParserPlugin 解析)
final
customErrorMessage String?
自定义错误消息(通过 errorMessageBuilder 生成)
final
data → T?
解析后的数据(经过 fromJson/fromBytes/fromResponse 解码后的数据)
final
error SmartError?
错误信息(成功时为空)
final
errorCode String?
错误码(便捷访问)
no setter
errorMessage String?
错误消息(优先返回自定义消息,否则返回原始错误消息)
no setter
hashCode int
The hash code for this object.
no setterinherited
headers Headers?
响应头
no setter
isSuccess bool
是否成功(无错误)
no setter
message String?
服务器返回的消息(通过 ResponseParserPlugin 解析)
final
parsedData → dynamic
经过 dataKey 解析但未经 decoder 解码的原始数据
final
raw Response?
原始 Dio 响应(错误时可能为空)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int
状态码
no setter
successMessage String?
成功消息(通过 successMessage 或 successMessageBuilder 生成)
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