Flutter DataTable

If you have fewer rows to display in a table, you can use DataTable.

DataTable is a materaial design data table where you can display a table with column labels and rows.

Note: Use DataTable if and only if you have fewer rows, because DataTable takes twice the computation for laying out elements on UI.


Following is the syntax of a DataTable.

DataTable contains columns and rows. columns property takes array of DataColumn and rows property takes array of DataRow. Each DataRow has cells property that takes array of DataCell.

label property of DataColumn takes Widget as value. Also DataCell takes widget as a value. You can provide Text, Image, Icon, or any other widget.


In the following example, we define a simple DataTable with three column labels and three rows.


When you run this Flutter application, you would get the DataTable displayed in UI as shown below.

Flutter DataTable


In this Flutter Tutorial, we learned how to define DataTable and display a data table in Flutter UI.