Chapter 9. Asynchronous programming with callbacks and futures

This chapter covers

  • The nonblocking async programming model
  • Callbacks for asynchronous APIs
  • Improving asynchronous readability with futures and completers
  • Unit-testing asynchronous code

In web programming, you can’t rely on events outside your application’s control happening in a specific order. In the browser, retrieving data from a server might take longer than you expect, and instead of waiting for the data, a user might click another button. A Dart server application will likely need to handle a new request for data before a previous request has finished reading data from the file system. This type of programming is known as an asynchronous model (async), and its counterpart ...

Get Dart in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.