Well, no. Dart has a single thread, or event-loop, of execution. However, commonly you’ll see a code using Future have a comment something to the effect of “// Avoid race conditions: Check for …”. What does that mean?

New to futures? Read asynchronous programming: Futures on the Dart site.

While Dart has a single thread of execution, it can interact with other code (Dart or otherwise, such as server-side) that runs in a separate thread. What Future<T> as an API means is simply “get a value, T, at a future point in time”. That time? It could be at the end of the microtask loop, it could be after a second, after a file is read from disk, after an RPC completes. It could also be never (due to a timeout, for example).

You can review all of the examples in this blog post on GitHub.

Let’s introduce a simple example:

We print the string “1”, “2”, “3”, and “4” — seemingly in order, but in reality it will print “1”, “4”, “2”, and “3”. That’s because “1” is printed synchronously, while “2” is printed at the end of the microtask loop, and “3” is printed a future event loop.

You can also use the Completer API to adapt a non-Future API: