Color theme
0 day streak0 XPP1
DartLearn mode
MISSION 1 OF 1

Handle a missing delivery note

0 XP earned
Dart track: IntermediateMission: BeginnerNullable stringsNull coalescingFallback values
Before you start this intermediate track

Typed functions and maps. The lessons use named parameters and nullable values.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 2 challenges
LEARN THE CONCEPT

Understand it, then try it.

A nullable String can hold text or null. The ?? operator supplies a fallback only when its left side is null. Here a delivery label needs useful text even when no note was entered. A supplied note, including an empty string, would otherwise remain unchanged by this expression.

travel_helper.dart
void main() {  String? deliveryNote = null;  final display = deliveryNote ?? 'Ring once';  print(display);}

Each mission is a complete Dart 3 program with its own main function. Run one at a time with dart run. Only the built-in dart:core library is used; Flutter is not required.

Track the values line by line. Predict the result before running this example in your own editor.