/// 封装http请求基础返回体 class BaseResponse { int? code; dynamic data; String? message; BaseResponse({this.code, this.data, this.message}); BaseResponse.fromJson(Map json) { code = json['code']; data = json['data']; message = json['message']; } Map toJson() { final Map data = {}; data['code'] = code; data['data'] = data; data['message'] = message; return data; } } /// 封装http请求基础返回体 class PaginationResponse { int? code; PaginationData? data; String? message; PaginationResponse({this.code, this.data, this.message}); PaginationResponse.fromJson(Map json) { code = json['code']; data = json['data']; message = json['message']; } Map toJson() { final Map data = {}; data['code'] = code; data['data'] = data; data['message'] = message; return data; } } class PaginationData { PaginationData({ required this.items, required this.meta, }); final List items; final Meta? meta; factory PaginationData.fromJson(Map json) { return PaginationData( items: json["items"], meta: json["meta"] == null ? null : Meta.fromJson(json["meta"]), ); } Map toJson() => { "items": items, "meta": meta?.toJson(), }; } class Meta { Meta({ required this.totalItems, required this.itemCount, required this.itemsPerPage, required this.totalPages, required this.currentPage, }); final int? totalItems; final int? itemCount; final int? itemsPerPage; final int? totalPages; final int? currentPage; factory Meta.fromJson(Map json) { return Meta( totalItems: json["totalItems"], itemCount: json["itemCount"], itemsPerPage: json["itemsPerPage"], totalPages: json["totalPages"], currentPage: json["currentPage"], ); } Map toJson() => { "totalItems": totalItems, "itemCount": itemCount, "itemsPerPage": itemsPerPage, "totalPages": totalPages, "currentPage": currentPage, }; }