Tsallaka zuwa abun ciki
Justice Tech School

Null Aware Operators

?., ??, ??= and ! handle nullable values. ! asserts non-null and can throw.

Example
String? a;
print(a?.length);
print(a ?? "none");
a ??= "set";
print(a);
print(a!.length);

Exercise

Assign if null.

a  "x"

Quiz Test

What does ! do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.