Blame view

lib/common/request/api_response/api_response_entity.dart 473 Bytes
056970d8   Key   feat: api
1
2
  import 'dart:convert';
  
c272c662   吴启风   fix: 崩溃修复
3
  import 'package:json_annotation/json_annotation.dart';
99b94d6c   吴启风   feat:首页增加信息弹窗
4
  
c272c662   吴启风   fix: 崩溃修复
5
  import 'api_response_entity.g.dart';
056970d8   Key   feat: api
6
  
c272c662   吴启风   fix: 崩溃修复
7
  @JsonSerializable(genericArgumentFactories: true)
056970d8   Key   feat: api
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  class ApiResponse<T> {
    int? code;
    String? msg;
    T? data;
  
    ApiResponse();
  
    factory ApiResponse.fromJson(Map<String, dynamic> json) => $ApiResponseFromJson<T>(json);
  
    Map<String, dynamic> toJson() => $ApiResponseToJson(this);
  
    @override
    String toString() {
      return jsonEncode(this);
    }
  }