1
I tried to use a if
to condition the display of a list of Widgets
:
children: <Widget>[
if (condicao == true)
{
Widget(),
Widget(),
}
],
The element type Set < Widget > can’t be Assigned to the list type 'Widget'.
It seems to me that in the design part the flutter does not interpret a {} as a scope as in the Dart
pure.
Have you ever tried something like
[...] children: condition ? getMyWidgetsArray() : [], [...]
? If the problem is just how Dart interprets it, that should solve it. I don’t know Dart, so this is just a pseudocode, I don’t know if this is compatible with language– Costamilam