import 'package:json_annotation/json_annotation.dart'; part 'base_data.g.dart'; @JsonSerializable(genericArgumentFactories: true) class BaseData { BaseData(); int code; T data; dynamic extra; bool isError; bool isSuccess; String msg; String path; String timestamp; factory BaseData.fromJson(Map json, T Function(dynamic json) fromJsonT) => _$BaseDataFromJson(json, fromJsonT); Map toJson(Object Function(T value) toJsonT) => _$BaseDataToJson(this, toJsonT); }