After running this inside my widget tree:
List<List<Widget>> widgets;
/***/
Column(
children: [
for (List<Widget> range in (widgets as List<List<Widget>>)) {
Row(children: range),
}
]
)
I got this error:
Error: A value of type 'Set<Row>' can't be assigned to a variable of type 'Widget'.
CodePudding user response:
Use this remove{
USED FOR THE FOR LOOP bracket
for (List<Widget> range in (widgets as List<List<Widget>>))
Row(children: range),
Set or map? The syntax for map literals is similar to that for set literals. Because map literals came first, {} defaults to the Map type. If you forget the type annotation on {} or the variable it’s assigned to, then Dart creates an object of type Map<dynamic, dynamicdart tour
Tip
Also we can use like this
Column(children: [
...widgets.map((e) {
return Row(children: e);
}),
]);
CodePudding user response:
That's because you try to affect something like [[...]] to column children instead of [], try something like that :
Column(children: widgets.map(element) => Row(children: element));