The Complete Flutter Course: Build Android, iOS and Web Apps

Futures, Streams and async code in Flutter

If async code leaves you unsure what runs next, this guide picks out the relevant lessons in The Complete Flutter Course: Build Android, iOS and Web Apps. Follow the change from written order to execution order through a delayed launchpad flash, blog posts arriving as the database changes, and an isolate that stops heavy work freezing the app.

Taught by Sagnik Bhattacharya and Paulina Knop

The Complete Flutter Course: Build Android, iOS and Web Apps: Sagnik Bhattacharya and Paulina Knop

What you will be able to do

You will be able to:

  • Use Future.delayed to postpone work, then wait for it within an async function.
  • Work out the execution order without await and recognise when subsequent code depends on a Future's result.
  • Choose between a Future for a single data read and a Stream for ongoing updates.
  • Use StreamBuilder to create a list from streamed data, with a loading spinner before it arrives.
  • Keep the interface responsive by moving heavy work into a separate isolate with Isolate.spawn.
  • Start listening to a stream only once, clearing and refilling lists as updates arrive.

Projects

What you will build.

The course has nine projects. These three matter most here.

  • Project 03

    Launchpad

    Meet Futures in an app by using Future.delayed to keep each pad white for half a second.

  • Project 04

    Portfolio website and app

    Compare an initial single read with the live Firestore stream that supplies the blog.

  • Project 08

    Budget app

    Follow streams that keep lists and totals current, starting them once and clearing lists before refilling them on updates.

Lessons

The lessons that matter, in course order.

The Complete Flutter Course: Build Android, iOS and Web Apps has 223 lessons. This page picks out 11 of them, 58 min of video. Each lesson keeps its number in the course.

Where to start

Lesson 80 Asynchronous code with async and await

Begin with Lesson 80: it uses DartPad, so no project is needed. If you have already built the launchpad, its flash in Lesson 45 offers a gentle introduction. Continue the portfolio with the stream lessons beginning at Lesson 128.

11 of 223 lessons · 58 min

08 Ninja challenge 2 - Launchpad app 1 of 5 lessons · 2 min Use async and Future.delayed for the launchpad's half-second flash, followed by playback of the pad's sound.
  1. 45 Ninja Challenge 2 solution: delay and audio Half-second flash with Future.delayed and player.play 2 min
09 Layouts, Gesture and animations: Landing Page Web (Portfolio) 2 of 35 lessons · 12 min Experiment in DartPad with async, await and Future.delayed. Compare execution without await and time delayed futures to identify when subsequent code depends on a result.
  1. 80 Start here Asynchronous code with async and await Future.delayed in DartPad and what happens without await 7 min
  2. 81 When to use await Timing delayed futures and when later code needs the result 5 min
16 Read data from Firebase using Flutter: Blog Page 4 of 6 lessons · 24 min Contrast a single get read with the blog's need for streams, then follow live snapshots updates into a list using StreamBuilder and ListView.builder.
  1. 128 Read Firestore data once with get() QuerySnapshot, docs.forEach and a call from initState 5 min
  2. 129 Why the blog needs streams A one-off get() misses new articles; streams push changes 5 min
  3. 130 Stream articles from Firestore Live updates via snapshots(), and title and body for BlogPost 7 min
  4. 131 ListView.builder and StreamBuilder Build posts from a list, then from live Firestore snapshots 6 min
20 Advanced State management 1 of 6 lessons · 9 min Explore multithreading through Dart isolates, using Isolate.spawn to execute a function on another thread.
  1. 158 Multithreading with Dart isolates Run work on another thread with Isolate.spawn 9 min
22 Budget App using Flutter Riverpod and MVVM architecture 3 of 47 lessons · 12 min Follow the budget app's incomes list and snapshots-based expenses stream, empty lists before each refill, and use an isLoading flag to start streams only once.
  1. 206 Incomes list and the expenses stream Finish the mobile layout, then listen with snapshots() 4 min
  2. 207 Reading Firestore documents into clean lists Empty the lists on each update to avoid duplicates 4 min
  3. 208 Starting the streams only once An isLoading flag to stay within Firestore's free reads 4 min

Instructors

Who teaches it.

Paulina Knop smiling, shoulder-length brown hair, wearing a black top.

Instructor, Flutter

Paulina Knop

Flutter developer and curriculum designer. Teaches the Flutter course.

Questions

Asked before starting.

Which Flutter course makes Futures, async and await clear?

The Complete Flutter Course: Build Android, iOS and Web Apps from Coding Liquids introduces these ideas in DartPad through timed, delayed futures and examples without await. Practical uses include a half-second pad flash, a Cloud Firestore blog read once before being streamed, and budget lists that track database changes. This guide selects 11 lessons, taking 58 minutes. Async error handling receives less attention and is not taught as a topic.

Should I choose a Future or a Stream for my data?

A single result delivered later, such as a one-off data read, calls for a Future. Choose a Stream when results continue to arrive, as they do when a database changes. In the portfolio blog, The Complete Flutter Course: Build Android, iOS and Web Apps contrasts get, which misses newly added articles as explained in Lesson 129, with snapshots, whose stream supplies changes as they happen.

What will my code do if I leave out await?

Execution continues rather than waiting for the result, so subsequent lines can run before the value is available. That can mean printing the Future rather than its value or trying to use data that has not arrived. The Complete Flutter Course: Build Android, iOS and Web Apps illustrates this in DartPad in Lesson 80; Lesson 81 then explains how to recognise a dependency that requires waiting.

How can StreamBuilder switch from a spinner to live data?

Before the stream supplies its first data, the builder returns a spinner because there is no data to display. It then builds a list from the arriving data and rebuilds it with each subsequent stream delivery. In Lesson 131, The Complete Flutter Course: Build Android, iOS and Web Apps applies this to the blog, using ListView.builder to turn Firestore documents into posts.

How can I stop heavy work freezing the interface?

Use an isolate for that work. Waiting with async and await does not block the app, but heavy calculations still execute on the interface's thread. An isolate has a separate thread and its own memory, allowing the screen to remain responsive. In Lesson 158, The Complete Flutter Course: Build Android, iOS and Web Apps uses Isolate.spawn to run a function in an isolate.

Does the course cover async error handling as a topic?

No. In the budget app, The Complete Flutter Course: Build Android, iOS and Web Apps catches errors returned by Firebase and displays them in a pop-up. It does not provide lessons on general error handling for Futures and Streams, StreamController, async generators or RxDart. After becoming familiar with these basics, Dart's asynchronous programming documentation covers those topics.

Flutter

See the whole course.

The Complete Flutter Course: Build Android, iOS and Web Apps: 25 hours of video in 223 lessons, built around 9 projects, with lifetime access, a Certificate of Completion and a 14-day money-back guarantee.