Flutter, Dart : What are Futures.

Saad El Oulladi
3 min readAug 23, 2019

Coming from an iOS background, some Dart concepts were completely new to me, especially Futures. it took me some time to understand their benefits.
So i wanted to explain in this brief article, what are dart Futures in simple words, and why i think they are awesome.

Future allows to return some value “Later”, or so called Asynchronously. We use it whenever we run something which is time consuming. Call a web service , read a file Ect…

A Future has three possible states :

  • Uncompleted.
  • Completed with success.
  • Completed with an error.

When just created a Future object is Incomplete. and according to the response we get the success value or the failure error.

Here is an example of a basic future usage :

First thing we notice is that main print, is called before future print, even the code is written in the opposite order. This is because everything done inside future is asynchronous.

--

--