Search code examples
arraysflutterflutter-widget

flutter column values use to return arrray


flutter datacolumn i m using column header value in direct function

like this

List<String> columnList = ['Name', 'age', 'Type','Expiry Date'];

how to write a function to return this columnList as array

I want to use like

List<String> columnList = columnList();

columnList function how to write it?


Solution

  • I'm not sure to understand your purpose, but if you want a return type, plz check below.

    List<String> columnList() {
       return ['Name', 'age', 'Type','Expiry Date'];
    }
    

    Then, you can use "columnList()".