My PaginatedDataTable
widget:
var shopData = ShopDataSource();
return PaginatedDataTable(
header: Text('Shops'),
columns: [
DataColumn(label: Text('Shop')),
DataColumn(label: Text('Type')),
DataColumn(label: Text('Location')),
DataColumn(label: Text('Status')),
DataColumn(label: Text('Actions')),
],
rowsPerPage: 5,
source: shopData,
);
ShopDataSource
class extending DataTableSource
like this:
class ShopDataSource extends DataTableSource {
var _shops;
// fetch data from provider
var docProvider = Provider.of(context);
DataRow getRow(int index) {
return DataRow.byIndex(cells: [
// dataCells
], index: index);
}
@override
bool get isRowCountApproximate => false;
@override
int get rowCount => _shops.length;
@override
int get selectedRowCount => 0;
}
My question: How to fetch data from DataProvider class to DataCell
s.
OR
Any alternate way of fetching data from Firestore
with StreamBuilder
or without this.