How to use short if in flutter
this code can use:
1 + 1 == 2 ? print('check true') : print('check false');
Ans. print('check true')
but I want to do this:
1 + 1 == 2 ?? print('check true');
Why code can't print check true?
Simply
1 + 1 == 2 ? print('check true') : print('check false');
is equals to
if(1+1 == 2) {
print('check true');
else {
print('check false');
}
and
1 + 1 == 2 ?? print('check true');
is equals to
if((1+1 == 2) == null ) {
print('check true');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With