Why this Widget should be returned as List?

207 Views Asked by At
(questionList[_questionIndex]['answers'] as List<String>).map((answer) { 
  return Answer(_textChanger, answer);
}).toList();

this code is part of my main.dart. that code is inside of Column(childer:). I want to ask why this code use "toList()"method to return as List?

1

There are 1 best solutions below

0
Jim On BEST ANSWER

Because Column children requires list of widgets:

children → List The widgets below this widget in the tree. [...] final, inherited

and toList() returns list of Answer widgets