mirror of
https://github.com/Uuttssaavv/flutter-clean-architecture-riverpod.git
synced 2025-08-06 16:19:42 +08:00
27 lines
609 B
Dart
27 lines
609 B
Dart
const int PER_PAGE_LIMIT = 20;
|
|
|
|
class PaginatedResponse<T> {
|
|
final int total;
|
|
|
|
final int skip;
|
|
|
|
static const limit = PER_PAGE_LIMIT;
|
|
|
|
final List<T> data;
|
|
|
|
PaginatedResponse(
|
|
{required this.total, required this.skip, required this.data});
|
|
|
|
factory PaginatedResponse.fromJson(dynamic json, List<T> data,
|
|
{Function(dynamic json)? fixture}) =>
|
|
PaginatedResponse(
|
|
total: json['total'] ?? 0,
|
|
skip: json['skip'] ?? 0,
|
|
data: data,
|
|
);
|
|
@override
|
|
String toString() {
|
|
return 'PaginatedResponse(total:$total, skip:$skip, data:${data.length})';
|
|
}
|
|
}
|