Decode FutureBuilder

An in-depth look at Flutter’s FutureBuilder Widget

class FutureBuilder as of April 03, 2019

I Like Screenshots. Click For Gists.

Other Stories by Greg Perry

Learn By Example

Fetch and display the data
class FutureBuilder as of April 03, 2019

A Future In Generics

How This Goes

It’s All in the Init

iniState() in FutureBuilder as of April 03, 2019

Give An Init Value

FutureBuilder() function as of April 03, 2019

The Future Has Class

The Complete Example as of April 03, 2019
The Complete Example as of April 03, 2019
At first, an ‘incomplete’ Future object

It Starts with a Build

FutureBuilder’s build() function as of Apr 3, 2019
The Complete Example as of April 03, 2019

Circular Progress At First

Cookbook example as of April 03, 2019

Null Has No Data

hasData in Class AsyncSnapshot as of April 03, 2019

Data of Type T

Generic data type, T, for the property data in Class AsyncSnapshot

Any Errors?

hasError in Class AsyncSnapshot as of April 03, 2019

So, What Happens Next?

Where the Magic Happens

_subscribe() in _FutureBuilderState<T> as of April 03, 2019

The Future Completes

_subscribe() in _FutureBuilderState<T> as of April 03, 2019
FutureBuilder’s build() function as of April 03, 2019

The Connection State of the Future Flow

Cookbook example with Switch statement
initState() in FutureBuilder as of April 03, 2019

Set We’re Waiting

_subscribe() in _FutureBuilderState<T> as of April 03, 2019

When It’s Done, It’s Data

So What Happened Back There?

_subscribe() in _FutureBuilderState<T> as of April 03, 2019

What Happens In Error?

Cookbook example as of April 03, 2019
Cookbook example as of April 03, 2019
_subscribe in FutureBuilder as of Apr 3, 2019
FutureBuilder’s build() function as of Apr 3, 2019
Cookbook example as of April 03, 2019
Property, error, in AsyncSnapshot class

TLDR.

What’s with this callbackIdentity?

_subscribe() in _FutureBuilderState<T> as of April 03, 2019
_subscribe() in _FutureBuilderState<T> as of April 03, 2019
Class FutureBuilder as of April 03, 2019
Class FutureBuilder as of April 03, 2019

The Future has been Disposed

Class FutureBuilder as of April 03, 2019

An Optional Future?

_subscribe in FutureBuilder as of Apr 3, 2019

A Builder is a Must

FutureBuilder as of Apr 3, 2019

No Future No Data No Error

Why No Future?

It’s a Future with a Then

Decode Flutter Series
DECODE Flutter on YouTube

Freelance Developer