// if else example in dart void main() { int number = 10; if(number >0) { print("Number is Positive"); }else if(number<0) { print("Number is Negative"); } else { print("Number is zero!"); } //output: //Number is Positive }void main() { var num = 2; if(num > 0) { print("${num} is positive"); } else if(num < 0) { print("${num} is negative"); } else { print("${num} is neither positive nor negative"); } } it will work inside an widget. Column( children: [ if(a > 10)...[ Text("A is greater than 10"), ]else...[ Text("A is less than or Equal to 10") ] ]) Normally: int time = 6; if(time > 12) { time = time - 12; print('$time PM'); }else { print('$time AM'); };void main() { var num=5; if (num>0) { print("number is positive"); } }void main() { var num = 12; if (num % 2==0) { print("Even"); } else { print("Odd"); } }