12345678910111213141516171819202122232425262728293031323334353637 |
- 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<T> {
- /*
- "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<String, dynamic> json,
- T Function(dynamic json) fromJsonT,
- ) =>
- _$ApiRspFromJson<T>(json, fromJsonT);
- Map<String, dynamic> toJson(Object? Function(T value) toJsonT) => _$ApiRspToJson(this, toJsonT);
- }
|