the element type 'List<widget>' can't be assigned to the list type 'Widget'
Here you are wrapping a list as list
children: <Widget>[getList()],
This should rather be
children: getList(),
Since the answer was not satisfactory for me, so I found another solution.
Flutter gives you the possibility to write conditions on a single line also in the graphic, so you can insert a cycle on a single line and then insert the other different widgets. This is a practical example in response to the main question:
Column(
children: <Widget>
[
for (int i = 0;
i < workouts.series.length;
i++)
"//CREATE N YOUR WIDGETS//",
new Text(
"${workouts.series.length} x ${exerciseWorkout.repsToDo} ",
style: TextStyle(
color: Colors.black87,
fontSize: 16,
fontWeight: FontWeight.bold),
)
],
)
Just use spread operator:
return new GridView.count(
crossAxisCount: 2,
padding: const EdgeInsets.all(10.0),
crossAxisSpacing: 10.0,
mainAxisSpacing: 10.0,
children: <Widget>[...getList()],
);