class ResponseModel { T? data; Meta? meta; Links? links; ResponseModel({this.data, this.meta, this.links}); ResponseModel.fromJson( Map json, T Function(dynamic) fromJsonT) { data = json['data'] != null ? fromJsonT(json['data']) : null; meta = json['meta'] != null ? Meta.fromJson(json['meta']) : null; links = json['links'] != null ? Links.fromJson(json['links']) : null; } Map toJson(Map Function(T) toJsonT) { final Map data = {}; if (this.data != null) { data['data'] = toJsonT(this.data as T); } if (meta != null) { data['meta'] = meta!.toJson(); } if (links != null) { data['links'] = links!.toJson(); } return data; } } class Meta { int? itemsPerPage; int? totalItems; int? currentPage; int? totalPages; List>? sortBy; Meta( {this.itemsPerPage, this.totalItems, this.currentPage, this.totalPages, this.sortBy}); Meta.fromJson(Map json) { itemsPerPage = json['itemsPerPage']; totalItems = json['totalItems']; currentPage = json['currentPage']; totalPages = json['totalPages']; if (json['sortBy'] != null) { sortBy = (json['sortBy'] as List) .map((item) => (item as List).map((e) => e.toString()).toList()) .toList(); } } Map toJson() { final Map data = {}; data['itemsPerPage'] = itemsPerPage; data['totalItems'] = totalItems; data['currentPage'] = currentPage; data['totalPages'] = totalPages; if (sortBy != null) { data['sortBy'] = sortBy!.map((v) => v).toList(); } return data; } } class Links { String? current; Links({this.current}); Links.fromJson(Map json) { current = json['current']; } Map toJson() { final Map data = {}; data['current'] = current; return data; } }