import 'package:json_annotation/json_annotation.dart'; import 'num_converter.dart'; import 'string_converter.dart'; part 'api_rsp.g.dart'; @JsonSerializable( genericArgumentFactories: true, converters: [NumConverter(), StringConverter()], ) class ApiRsp { /* "code": 0, "data": , "msg": "string" */ final num? code; final T? data; final String? string; const ApiRsp({ this.code, this.data, this.string, }); factory ApiRsp.fromJson( Map json, T Function(dynamic json) fromJsonT, ) => _$ApiRspFromJson(json, fromJsonT); Map toJson(Object? Function(T value) toJsonT) => _$ApiRspToJson(this, toJsonT); }