class PaginateResponse { int total; int perPage; int currentPage; int lastPage; int from; int to; List data; PaginateResponse( {required this.total, required this.perPage, required this.currentPage, required this.lastPage, required this.from, required this.to, required this.data}); factory PaginateResponse.fromJson( Map json, Function fromJsonModel) { final data = json['data'].cast>(); return PaginateResponse( total: json['total'] as int, perPage: json['per_page'] as int, currentPage: json['current_page'] as int, lastPage: json['last_page'] as int, from: json['from'] as int, to: json['to'] as int, data: List.from( data.map((dataJson) => fromJsonModel(dataJson)) as Iterable)); } }