How to update the table if page is changed and values refreshed from API in flutter

I am using PaginatedDataTable in my application. Using API, i am fetching first 10 set of row values and displaying, if i click next page, i increased my page number and again called getAPI(). But it is updating anything.

One more issue, when fetching next time , my index values start from 0 to 9 . but in getRow() method in DataSource starts from 11.

How to overcome these issues.


class TableDataSource extends DataTableSource {
  TableData tableData;
  int _selectedCount = 0;
  DataRow getRow(int index) {
    assert(index >= 0);
    if (index >= tableData.value.totalElements) return null;
    var data = tableData.value.content[index];

    return DataRow.byIndex(index: index, cells: getDataCells(data));

  List<DataCell> getDataCells(dynamic data) {
    List<DataCell> dataCellList = new List<DataCell>();
    for (int i = 0; i < data.values.length; i++) {
      var cell = new DataCell(
        child: Text(
    return dataCellList;

  bool get isRowCountApproximate => false;

  int get rowCount => tableData.value.totalElements;

  int get selectedRowCount => _selectedCount;

Inside Build method:

              header: getHeader(),
              columns: getColumns(tableData),
              source: TableDataSource(tableData),
              onPageChanged: (value) {

how to fetch 10 datas from API and again in next page click another 10 datas.

Any help is really appreciated

Have you figured out?