Flutter学习之DIO4.0的封装

更新时间:2023-07-09 17:59:07 阅读: 评论:0

BaResponData({spCode, spDesc, this.attribute, this.data});
@override冰封之心
String toString() {
return 'BaRespData{code: $respCode, message: $respDesc, data: $attribute}';  }
}
class ResponData extends BaResponData {
@override
bool get success => respCode != null || data != null;
ResponData.fromJson(Map<String, dynamic> json) {
if (json['respCode'] != null && json['respCode'] is String) {
json['respCode'] = int.par(json['respCode']);
}
老人与海主要内容
respCode = json['respCode'] ?? json['code'];
respDesc = json['respDesc'] ?? json['message'] ?? json['msg'];
attribute = json['attribute'] ?? json["data"];
if (attribute != null) {
if (attribute is Map && ainsKey("data")) {
data = attribute['data'];
} el {
data = attribute;
打开微信时需要密码怎么设置}
} el {
data = json;
}
}
}
class ResponError extends BaResponData {
ResponError.fromJson(Map<String, dynamic> json) {
respDesc = json["respDesc"];
respCode = json["respCode"];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = {};
三倍工资
data["respDesc"] = respDesc;
次弟花开data["respCode"] = respCode;
return data;
兔子猫
}
@override
// TODO: implement success
bool get success => fal;
}
class ResponException implements Exception {
int? errCode;
鳄雀鳝图片String? errMsg;
ResponException({Code});
int? get errorCode => errCode;
//statusCode==200时候返回的data中存在的respCode
String? get errorMessage {
String msg = errMsg ?? "";
switch (errCode) {
default:
}
return msg;
}
@override
String toString() {
访问googlereturn 'RequestException{errorCode: $errorCode, errorMessage: $errorMessage}';  }
}

本文发布于:2023-07-09 17:59:07,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1087737.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:返回   需要   密码   老人与海
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图