Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

dart ?? operator

??

Called also null operator. This operator returns expression on its left, except if it is null, and if so, it returns right expression:

void main() {
  print(0 ?? 1);  // <- 0
  print(1 ?? null);  // <- 1
  print(null ?? null); // <- null
  print(null ?? null ?? 2); // <- 2
}

Source by jelenaaa.medium.com #
 
PREVIOUS NEXT
Tagged: #dart #operator
ADD COMMENT
Topic
Name
5+5 =