Mobile development

Stage 1 · Lesson 8 of 10

Futures, async and await

Dart fundamentals

A is a value that arrives later, such as the answer to an request. Mark a function async, await the Future inside it, and wrap it in try and catch for errors. runs your code on one thread with an event loop, a queue of jobs it works through one at a time.

So await pauses only that function, while the UI keeps drawing. Run independent work together with Future.wait([a(), b()]) instead of waiting for one after the other. Heavy CPU work, such as parsing a huge file, still blocks the thread. That is when help, but you can leave them for later.

Common trapforgetting await, so code runs before the value exists and errors go nowhere.

A question to check yourself, an AI practice session and 2 cheat sheet entries 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?