O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Working with Futures, Tasks, and Isolates

In this chapter, we will cover the following recipes:

  • Writing a game loop
  • Error handling with Futures
  • Scheduling tasks using Futures
  • Running a recurring function
  • Using isolates in the Dart VM
  • Using isolates in web apps
  • Using multiple cores with isolates
  • Using the Worker Task framework

Introduction

The Future class from dart:async lies in the basis of all asynchronous programming in Dart. A Future is, in fact, a computation that is deferred; it represents an object whose value will be available sometime in the future. It is not available immediately, because the function that returns its value depends on some kind of input/output and is, thus, unpredictable by nature. Here are some examples: a time-consuming ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required