If and ElseIf| Flutter | Dart

Syed Ameenuddin
Jan 26, 2022

Hi, so here we are going to learn about if and else and nested if and else.

normally flutter throws err if we use dart if and else. flutter has some formality to use if and else into widgets. so here they are

IF AND ELSE

if and else

// condition ? if true means: else ;

1==1? Container(‘if succesed’): Container(‘else show this’);

NESTED IF AND ELSE

Nested If and Else

Or

// condition if :condition if:condition if: else

1==1? Container(): 1==2? Container(): 1==3?Container():Container(),

CODE: https://github.com/syedAmeenuddin/Flutter-IF-and-Else/blob/main/ifandelse.dart

So, now you guys got a clear view of how to use if and else in a flutter. right?

happy flutter, let us meet in new content bye…

--

--