ApiResponse<T>.fromJson constructor

ApiResponse<T>.fromJson(
  1. Map<String, dynamic> json,
  2. T fromJsonT(
    1. Object? json
    )
)

Implementation

factory ApiResponse.fromJson(
  Map<String, dynamic> json,
  T Function(Object? json) fromJsonT,
) {
  return ApiResponse<T>(
    data: json['data'] != null ? fromJsonT(json['data']) : null,
    results: json['results'] != null ? fromJsonT(json['results']) : null,
    status: json['status'],
    message: json['message'],
    count: json['count'],
    next: json['next'],
    previous: json['previous'],
    currentPage: json['current_page'],
    itemsPerPage: json['items_per_page'],
    totalItems: json['total_items'],
    isLastPage: json['is_last_page'],
  );
}