How do I create a loop or if-statement inside a widget in flutter? It seems that you only can make a single line condition like: if(condition) but if you try to use brackets: if(condition){ } it gives an error. The same thing happens whith loops.
I want to be able to:
RichText( text: TextSpan( text: 'Logg\n', children: <TextSpan>[ if(condition){ TextSpan( text: 'Text1\n',), TextSpan( text: 'Text2\n',), }else{ TextSpan( text: 'Text3\n',), TextSpan( text: 'Text4\n',), } ] )