base_model.dart 569 B

123456789101112131415161718192021222324252627
  1. class BaseModel {
  2. int id = 0;
  3. }
  4. class BaseEntity {
  5. ///状态码 0:成功 其他异常
  6. int code = 0;
  7. /// 提示信息
  8. String msg = "";
  9. /// 数据
  10. BaseModel? data;
  11. BaseEntity({required this.code, required this.msg, this.data});
  12. BaseEntity.fromJson(Map<String, dynamic> json) {
  13. code = json['code'];
  14. msg = json['msg'];
  15. data = json['data'];
  16. }
  17. Map<String, dynamic> toJson() {
  18. final Map<String, dynamic> data = <String, dynamic>{};
  19. data['code'] = code;
  20. data['msg'] = msg;
  21. data['data'] = this.data;
  22. return data;
  23. }
  24. }