Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
(questionList[_questionIndex]['answers'] as List<String>).map((answer) { return Answer(_textChanger, answer); }).toList();
这段代码是我的 main.dart 的一部分。该代码位于 Column(childer:) 内部。我想问为什么这段代码使用“toList()”方法作为List返回?
因为Column children 需要小部件列表:
children → List 树中此小部件下方的小部件。[...] 最终的,继承的
和 toList() 返回答案小部件的列表