List Response

The API pagination response splits large datasets into smaller, manageable pages.
{
    "message": "Success",
    "statusCode": 200,
    "success": true,
    "data": { // <-- products list_response
        "total": 194,
        "data": [ // <-- products list
            {
                "id": 1,
                "title": "Essence Mascara Lash Princess",
                "category": "beauty",
                "price": 9.99,
                "rating": 4.94,
                "stock": 5
            }
        ]
    }
}
so the http request for fetch paged data should receive “BaseResponse<ListResponse<T>>” (Example with retrofit):
@RestApi()
abstract class ProductRestClient {
  factory ProductRestClient(Dio dio) = _ProductRestClient;

  @GET("/products")
  Future<BaseResponse<ListResponse<Product>>> findAll({
    @Query("page") required int page,
    @Query("per_page") int perPage = 25,
  });
}

Full Example:

animated_infinite_scroll_pagination