Commit 952317b469f7cc02ffdde77346a5fd9b958c35a0
1 parent
607982c3
Revert "build change"
This reverts commit 607982c3.
Showing
1 changed file
with
36 additions
and
0 deletions
lib/common/request/api_response/api_response_entity.g.dart
0 → 100644
1 | +import 'package:flutter/foundation.dart'; | |
2 | + | |
3 | +import '../../../generated/json/base/json_convert_content.dart'; | |
4 | +import 'api_response_entity.dart'; | |
5 | + | |
6 | +ApiResponse<T> $ApiResponseFromJson<T>(Map<String, dynamic> json) { | |
7 | + final ApiResponse<T> apiResponseEntity = ApiResponse<T>(); | |
8 | + final int? code = jsonConvert.convert<int>(json['code']); | |
9 | + if (code != null) { | |
10 | + apiResponseEntity.code = code; | |
11 | + } | |
12 | + final String? msg = jsonConvert.convert<String>(json['msg']); | |
13 | + if (msg != null) { | |
14 | + apiResponseEntity.msg = msg; | |
15 | + } | |
16 | + String type = T.toString(); | |
17 | + T? data; | |
18 | + if (kDebugMode) { | |
19 | + print("ApiResponse<T> T-type:$type, data-type:${json['data'].runtimeType}"); | |
20 | + } | |
21 | + if (json['data'] != null) { | |
22 | + data = JsonConvert.fromJsonAsT(json['data']); | |
23 | + } | |
24 | + if (data != null) { | |
25 | + apiResponseEntity.data = data; | |
26 | + } | |
27 | + return apiResponseEntity; | |
28 | +} | |
29 | + | |
30 | +Map<String, dynamic> $ApiResponseToJson(ApiResponse entity) { | |
31 | + final Map<String, dynamic> data = <String, dynamic>{}; | |
32 | + data['code'] = entity.code; | |
33 | + data['msg'] = entity.msg; | |
34 | + data['data'] = entity.data; | |
35 | + return data; | |
36 | +} | ... | ... |