Iterating through a list to render multiple widgets in Flutter?

I have a list of strings defined like this:

var list = ["one", "two", "three", "four"]; 

I want to render the values on the screen side by side using text widgets. I have attempted to use the following code to attempt this:

for (var name in list) {
   return new Text(name);

However, when I run this code, the for loop only runs once and there is only one text widget that get rendered which says one (the first item in the list). Additionally, when I add a log message inside my for loop, it gets triggered once as well. Why isn't my for loop looping based on the length of the list? It seems to run only once and then quit.


1 Likes206.05 GEEK