Right now what I do is this:
Row(children: generateWidgets(numbers))
List<Widget> generateWidgets(List<String> numbers){
final widgets List<Widget> = [];
for(int i = 0; i < numbers.length; i++){
widgets.add(Text(numbers[i]))
}
return widgets;
}
I would like to achieve the same thing without needing to make a function and instead have the code of the function as the parameter.
So what i'm looking for is a way to do something more like this:
Row(children: {
final widgets List<Widget> = [];
for(int i = 0; i < numbers.length; i++){
widgets.add(Text(numbers[i]))
}
return widgets;
})