BasicModel.fromJson constructor
BasicModel.fromJson(
- Map<String, dynamic>? json,
- dynamic response
)
Implementation
BasicModel.fromJson(Map<String, dynamic>? json, ExtendedResponse response) {
statusCode = response.statusCode;
statusMessage = response.statusMessage;
code = statusCode.toString();
msg = '服务器异常';
original = response;
if (json != null) {
final dioOptions = BasicDio().basicDioOptions;
final codeValue = _getValue(dioOptions.codeKeys, json);
if (codeValue != null) code = codeValue!.toString();
final msgValue = _getValue(dioOptions.msgKeys, json);
if (msgValue != null) msg = msgValue!.toString();
data = _getValue(dioOptions.dataKeys, json);
extension = _getValue(dioOptions.extensionKeys, json);
}
}