Search code examples
flutterpaginationflutter-desktop

Flutter paginated data table with separate API request on each page


I am using PaginatedDataTable widget to show my data which requires all the data from the start. e.g. I want 10 entries per page and I have 100 data records (entries) so the widget requires the 100 data records in order to build the UI. But the project has a great potential for large amount of data records.

Is there a way (or other widget) to build a paginated table with multi request (fetch each time you change the page from db (call api)) in order to avoid long duration loading when we try to fetch all the data at once?


Solution

  • Fetching large data in the app can affect the performance and hence the UX.

    You could achieve the pagination logic using the infinite pagination or custom pagination list

    For this, the pagination logic must be implemented in the server and the response should contain the total page number and current page number along with the data

    You can find some useful packages for infinite pagination in pub.dev