import 'package:json_annotation/json_annotation.dart'; import 'list_result.dart'; part 'list_response.g.dart'; /// 统一返回+通用分页 数据结构 @JsonSerializable( genericArgumentFactories: true, // fieldRename: FieldRename.snake, ) class BaseListResponse { /// 调用接口业务相关代码 @JsonKey(name: 'code') int code; /// 调用接口是否成功 @JsonKey(name: 'success') bool success; /// 调用接口提示语 @JsonKey(name: 'msg') String? msg; /// 日志id @JsonKey(name: 'log_id') String? logId; /// 调用接口返回数据 @JsonKey(name: 'data') BaseListResult data; BaseListResponse( {required this.code, required this.success, this.msg, this.logId, required this.data}); factory BaseListResponse.fromJson( Map json, T Function(dynamic json) fromJsonT) => _$BaseListResponseFromJson(json, fromJsonT); Map toJson(Object? Function(T value) toJsonT) => _$BaseListResponseToJson(this, toJsonT); }