Flutter loop inside a widget. Create a method and within it create a list of widgets. Include the widgets and then return the list.
Here is a quick example:
1 2 3 4 5 6 7 8 9 10 11 | child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: ListMyWidgets()), List<Widget> ListMyWidgets() { List<Widget> list = new List(); list.add(new Text("hi")); list.add(new Text("hi2")); list.add(new Text("hi3")); return list; } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.