Mobile development

Stage 1 · Lesson 6 of 10

List, Map and Set

Dart fundamentals

Most screens show a List, look things up in a Map and track selections in a Set. Learn how to write each one directly: [1, 2], {'a': 1} and {1, 2}. Then learn the operations: map, where, fold, any, firstWhere, sort and toList.

Note that map and where return a lazy Iterable, a sequence that is only worked out when read. So you often add .toList() before passing the result to a . Collection if and for let you build lists inline, as in [if (isAdmin) adminTile, for (final p in posts) PostTile(p)]. You will use that constantly in .

Common trapsorting or adding to a list in place and expecting the UI to notice; create a new list instead.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with

  • GuideFree
    Dart Language Tour

    Google · Beginner

    The official tour: read it in order and rerun every example in DartPad

Practise

  • Dart, TypeScript, Kotlin and Swift tracks with small exercises and free mentor feedback

Keep handy

  • Its Dart tutorial pages work as a quick lookup while you do the tour

Also worth your time

Mark this stage as not done?