How to refresh the data table after data appended
List results = [];
DataRow _getDataRow(index, data) {
return DataRow(
cells: <DataCell>[
DataCell(Text(results[index]['item_code'])),//add name of your columns here
DataCell(Text(results[index]['item_name'])),
DataCell(Text(results[index]['rate'])),
DataCell(Text("10")),//add name of your columns here
DataCell(Text("here")),
],
);
}
2
Answers
actually the function named
_getDataRow
is a template for the actual objects which will be invoked in the page, so you need to call it and use any state management to update the content, I suggest to use bloc or providerWhile a state management using for example BLoC should be preferred,
for quick testing you can use the setState argument inside of a StatefulWidget like this…