Dart Conditional Expressions: Ternary Operator of Java. Dart Flutter Tutorial #4.2

preview_player
Показать описание

In this beginner tutorial, explore conditional expressions which is similar to what we have as ternary operator in Java. Also explore second type of expression such as "expression1 ?? expression2".

.
Please donate and support my work
(If you think my free tutorials are better than paid ones :)

Free Programming courses:

Free Flutter course:

Free Android courses:

More free programming courses:

Check out my website:

Let's get in touch! [Sriyank Siddhartha]

---- Thank you for your love and support ----
Рекомендации по теме
Комментарии
Автор

4:50
Maybe this would also be a great solution:
print("${a < b ? a : b} is smaller");

Nypro
Автор

print("${a>b ? b : a} is smaller than ${a<b ? b : a}" ) ; //In one line :-)

mohanbarman
Автор

You might like me got an error on trying to let the String variable stay null, I found out that after flutter 2.0 which brought in Null safety feature, you need to specify the variable is nullable as follow:
_String ? name = null_

justarandomfishguy
Автор

Sir It Show Me Error: A value of type 'Null' can't be assigned to a variable of type 'String'.

dineshbhavsar
Автор

Hi,
I am trying to type syntax same as you for testing the second method of conditional expressions exp1 ?? exp2.
String name = "Allan";
String nameToPrint = name ?? "Guest User";
print(nameToPrint);

On the first expression name the program is showing an error "Condition must have a static type of 'bool'
In the output window the error pointer is pointing on second question mark, also the red mark is pointing on second question mark in the code.

Can you please help me finding out the actual error?

Thanks for presenting such a helpful series of videos.

SyedAlirazarizvi
Автор

unlocked: i <= unlockedLevels, booleanExpression dart whitch video can i found?

faisalfotoh
Автор

String name=null;
got error on above line
The value 'null' can't be assigned to a variable of type 'String' because 'String' is not nullable.

imgeekyt
Автор

String name = null; is not working ! but String? name = null; is working explain ?

ritikmitra
Автор

Please tell me how to take input from the user.

chiragbansal
Автор

now you can't assign String name = null .. It should be String? name = null; or it will not work .

wajdibac
Автор

Actually it's combination of Java and python.but if you know python you can learn it in week😂.

vennela_gandrathi