ResponseKeyMap class

响应 key 映射配置

用于配置后端统一响应格式中 code/msg/data 的字段名。

示例:

// 默认映射
ResponseKeyMap() // code, msg, data

// 自定义映射
ResponseKeyMap(
  codeKey: 'status',
  msgKey: 'message',
  dataKey: 'result',
)

Constructors

ResponseKeyMap({String codeKey = 'code', String msgKey = 'msg', String dataKey = 'data'})
const
ResponseKeyMap.fromMap(Map<String, String> map)
从 Map 创建
factory

Properties

codeKey String
业务码字段名,默认 "code"
final
dataKey String
数据字段名,默认 "data"
final
hashCode int
The hash code for this object.
no setterinherited
msgKey String
消息字段名,默认 "msg"
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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