flutter column values use to return arrray

Viewed 91

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?

2 Answers

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()".

Dart arrays are actually Lists. So columnList here is an array too. Simple return it as array

Related