title: flutter using DataTable sorting built in function
body: <p>How do I use the built in function for sorting columns on <code>DataTable</code>.
  Is it possible to do for multiple columns, so that when I press the sort icon it actually sorts the list?</p>
  
  <p>Thanks for any support : )</p>
  
  <pre><code>class HomePageState extends State&lt;HomePage&gt; {
    @override
    Widget build(BuildContext context) {
      var myColumns = [
        new DataColumn(label: new Text('name')),
        new DataColumn(label: new Text('age')),
        new DataColumn(label: new Text('Hight')),
      ];
  
      var myRows = [
        new DataRow(cells: [
          new DataCell(new Text('George')),
          new DataCell(new Text('18')),
          new DataCell(new Text('173cm')),
        ]),
        new DataRow(cells: [
          new DataCell(new Text('Dave')),
          new DataCell(new Text('21')),
          new DataCell(new Text('183cm')),
        ]),
        new DataRow(cells: [
          new DataCell(new Text('Sam')),
          new DataCell(new Text('55')),
          new DataCell(new Text('170cm')),
        ])
      ];
  
      return new Scaffold(
        body: new Center(
          child: new Container(
              child: new DataTable(
            columns: myColumns,
            rows: myRows,
            sortColumnIndex: 0,
            sortAscending: true,
          )),
        ),
      );
    }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/n9ysY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/n9ysY.png" alt="enter image description here"></a></p>