FirebaseDatabaseDataTable class

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 FirebaseDatabaseDataTable know what are the expected keys in a Firestore document.

An example usage would be:

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

// ...

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

Constructors

FirebaseDatabaseDataTable({Key? key, required Query query, required Map<String, Widget> columnLabels, Widget? header, void onError(Object error, StackTrace stackTrace)?, bool canDeleteItems = true, List<Widget>? actions, int? sortColumnIndex, bool sortAscending = true, double dataRowHeight = kMinInteractiveDimension, double headingRowHeight = 56.0, double horizontalMargin = 24.0, double columnSpacing = 56.0, bool showCheckboxColumn = true, bool showFirstLastButtons = false, void onPageChanged(int page)?, int rowsPerPage = 10, DragStartBehavior dragStartBehavior = DragStartBehavior.start, Color? arrowHeadColor, double? checkboxHorizontalMargin})
A PaginatedDataTable that is connected to Firestore.
const

Properties

actions → List<Widget>?
Icon buttons to show at the top end side of the table. The header must not be null to show the actions.
final
arrowHeadColor → Color?
Defines the color of the arrow heads in the footer.
final
canDeleteItems → bool
Whether documents can be removed from firestore using the table.
final
checkboxHorizontalMargin → double?
Horizontal margin around the checkbox, if it is displayed.
final
columnLabels → Map<String, Widget>
The columns and their labels based on the property name in Firestore
final
columnSpacing → double
The horizontal margin between the contents of each data column.
final
dataRowHeight → double
The height of each row (excluding the row that contains column headings).
final
dragStartBehavior → DragStartBehavior
Determines the way that drag start behavior is handled.
final
hashCode → int
The hash code for this object.
no setterinherited
The table card's optional header.
final
headingRowHeight → double
The height of the heading row.
final
horizontalMargin → double
The horizontal margin between the edges of the table and the content in the first and last cells of each row.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onError → void Function(Object error, StackTrace stackTrace)?
When specified, will be called whenever an interaction with Firestore failed, when as when trying to delete an item without the proper rights.
final
onPageChanged → void Function(int page)?
Invoked when the user switches to another page.
final
query → Query
The firestore query that will be displayed
final
rowsPerPage → int
The number of rows to show on each page.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showCheckboxColumn → bool
Whether the widget should display checkboxes for selectable rows.
final
showFirstLastButtons → bool
Flag to display the pagination buttons to go to the first and last pages.
final
sortAscending → bool
Whether the column mentioned in sortColumnIndex, if any, is sorted in ascending order.
final
sortColumnIndex → int?
The current primary sort key's column.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _FirestoreTableState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited