Color theme
0 day streak0 XPP1
DartQuiz mode
MISSION 1 OF 3

Find a train platform

0 XP earned
Dart track: IntermediateMission: BeginnerMapsDynamic keysLookup
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 / 6 challenges
KNOWLEDGE CHECK

Predict the result.

Which platform label is printed?

travel_helper.dart
void main() {  final platforms = {'cedar': 'B4', 'harbor': 'D2'};  final destination = 'harbor';  final platform = platforms[destination];  print(platform);}

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.

Review the lesson

A map connects keys to values. This station map connects destination names to platform labels, so the program can look up a destination selected by the traveler. Square brackets use the value inside destination as the key. The program prints the matching label without depending on the map entry order.

Choose your answer+25 XP on first completion