I have a column, is it possible to extract from it the list of children that are in this widget?
final listWidget = [];
listWidget.add(
Column(children: [
SizedBox(),
SizedBox(),
SizedBox(),
],
));
Can I extract a column from listWidget and then its children?
I thought I could conditionally do that:
listWidget[0].childrens.toList();
But unfortunately, that’s not how it works
2
Answers
Running your example, you would get:
since it doesn’t know the correct type.
To fix the issue, you can tell Dart the correct type using the
as
keyword:In your code: