Blame view

lib/common/request/api_response/api_response_entity.g.dart 1.04 KB
056970d8   Key   feat: api
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  import 'package:flutter/foundation.dart';
  
  import '../../../generated/json/base/json_convert_content.dart';
  import 'api_response_entity.dart';
  
  ApiResponse<T> $ApiResponseFromJson<T>(Map<String, dynamic> json) {
    final ApiResponse<T> apiResponseEntity = ApiResponse<T>();
    final int? code = jsonConvert.convert<int>(json['code']);
    if (code != null) {
      apiResponseEntity.code = code;
    }
    final String? msg = jsonConvert.convert<String>(json['msg']);
    if (msg != null) {
      apiResponseEntity.msg = msg;
    }
    String type = T.toString();
    T? data;
    if (kDebugMode) {
1892df31   Key   优化接口调用
19
      print("ApiResponse<T> T-type:$type, data-type:${json['data'].runtimeType}");
056970d8   Key   feat: api
20
21
    }
    if (json['data'] != null) {
bcd47f52   Key   fixed: 接口list范型支持
22
      data = JsonConvert.fromJsonAsT(json['data']);
056970d8   Key   feat: api
23
24
25
26
27
28
29
30
31
32
33
34
35
36
    }
    if (data != null) {
      apiResponseEntity.data = data;
    }
    return apiResponseEntity;
  }
  
  Map<String, dynamic> $ApiResponseToJson(ApiResponse entity) {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['code'] = entity.code;
    data['msg'] = entity.msg;
    data['data'] = entity.data;
    return data;
  }