Flutter · One codebase, native feel

How does asynchronous programming work in Flutter?

Mediumasyncawaitevent looperrorsUpdated Oct 2026
Quiz this track

Short answer

Dart runs an event loop per isolate. async and await sequence asynchronous operations without blocking the thread, but CPU-heavy work must move to an isolate to keep frames smooth.

Dart executes synchronous code to completion, then drains microtasks, then handles events. A Future represents a value available later. await suspends the current async function and lets the event loop run other work. It does not create a thread, so a long synchronous loop still blocks rendering.

dart
Future<DashboardData> loadDashboard(ApiClient api) async {
  final statsFuture = api.fetchStats();
  final activityFuture = api.fetchActivity();

  try {
    final stats = await statsFuture;
    final activity = await activityFuture;
    return DashboardData(stats: stats, activity: activity);
  } on TimeoutException {
    throw DashboardException('Request timed out');
  }
}
Both requests start before the first await, so they run concurrently while errors are handled in one place.
  • Never perform network or CPU work directly in build
  • Handle errors with try and catch; unhandled async errors surface as zone errors
  • Use Future.wait for a fixed group of futures and decide on eagerError behaviour
  • Cancel or ignore stale responses when a newer request supersedes them
  • Use unawaited only when intentionally fire-and-forget, and still handle failures

What await does not do

await does not run work in parallel on another thread. Two futures can progress concurrently because the underlying I/O is asynchronous, but Dart code still runs on the isolate's event loop. Parsing a large JSON payload or compressing an image synchronously will jank even inside an async function.

After an await inside a State, check mounted before calling setState. The widget may have been disposed while the request was pending.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1What is the difference between the microtask queue and the event queue?
  2. 2How do you run two independent requests concurrently?
  3. 3What happens if you call setState after dispose?
  4. 4When should work move to an isolate?

Say it in the interview

Dart uses an event loop per isolate. async and await let me sequence I/O without blocking, but they do not create threads. If I start two requests before awaiting either, they progress concurrently, and I handle errors around them. CPU-heavy work still has to move to an isolate, and after any await I check that the widget is still mounted before touching state.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Flutter mock interview and get scored feedback on depth, clarity and confidence.