flutter
Create 10 container widgets using loop flutter
We can create a list of widgets using for loop in flutter. You can check the below example for that where we are creating 10 container widgets.
Column(
children: [
for (int i = 0; i < 9; i++) Container(child: Text(i))
],
)
Row(
children: [
for (var item in [1,2,3]) Text(item)
]
)
In the above example, we have a list that contains three items in number format. We can loop through this list to generate multiple widgets as Row widget children.
Was this helpful?
Similar Posts