CellBuilder typedef

CellBuilder = Widget Function(QueryDocumentSnapshot<Map<String, Object?>> snapshot, String colKey)

A PaginatedDataTable that is connected to Firestore.

The parameter columnLabels is required and is used to

  • list the columns.
  • give them a label.
  • order the columns.
  • let FirestoreDataTable know what are the expected keys in a Firestore document.

An example usage would be:

// A collection of {'name': string, 'age': number}
final usersCollection = FirebaseFirestore.instance.collection('users');

// ...

FirestoreDataTable(
  query: usersCollection,
  columnLabels: {
     'name': Text('User name'),
     'age': Text('age'),
  },
);

Implementation

typedef CellBuilder = Widget Function(
  QueryDocumentSnapshot<Map<String, Object?>> snapshot,
  String colKey,
);