base_resp.dart
1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import 'package:dio/dio.dart';
/// <BaseResp<T> 返回 status code msg data.
class BaseResp<T> {
String status;
int code;
String msg;
T data;
Map responseData;
BaseResp(this.status, this.code, this.msg, this.data,this.responseData);
@override
String toString() {
StringBuffer sb = new StringBuffer('{');
sb.write("\"status\":\"$status\"");
sb.write(",\"code\":$code");
sb.write(",\"msg\":\"$msg\"");
sb.write(",\"data\":\"$data\"");
sb.write('}');
return sb.toString();
}
}
/// <BaseRespR<T> 返回 status code msg data Response.
class BaseRespR<T> {
String status;
int code;
String msg;
T data;
Response response;
BaseRespR(this.status, this.code, this.msg, this.data, this.response);
@override
String toString() {
StringBuffer sb = new StringBuffer('{');
sb.write("\"status\":\"$status\"");
sb.write(",\"code\":$code");
sb.write(",\"msg\":\"$msg\"");
sb.write(",\"data\":\"$data\"");
sb.write('}');
return sb.toString();
}
}