Files
jiu/client/lib/core/models/page_result.dart
T
wangjia 75e3b934bc
Deploy / build-windows (push) Failing after 9s
Deploy / build-linux-web (push) Successful in 51s
Deploy / release-deploy (push) Has been skipped
chore: release v1.0.3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 22:39:04 +08:00

28 lines
618 B
Dart

class PageResult<T> {
final List<T> data;
final int total;
final int page;
final int pageSize;
const PageResult({
required this.data,
required this.total,
required this.page,
required this.pageSize,
});
factory PageResult.fromJson(
Map<String, dynamic> json,
T Function(Map<String, dynamic>) fromJson,
) {
return PageResult(
data: ((json['data'] as List?) ?? [])
.map((e) => fromJson(e as Map<String, dynamic>))
.toList(),
total: json['total'] as int,
page: json['page'] as int,
pageSize: json['page_size'] as int,
);
}
}