How to Correctly use Flutter's Future Builder Widget

preview_player
Показать описание
One of the most powerful Widgets Flutter has is the FutureBuilder. However, it also happens to be one of the widgets that people get confused about. So in this week's video I thought it would be a good idea to take a look at how to correctly use this awesome widget so that you can benefit from it.

FutureBuilder Official Docs:

--------------------

WEBSITE:

FACEBOOK:

TWITTER:
Рекомендации по теме
Комментарии
Автор

"a piece of data that is of type Future, and not the future itself" - Just what the documentation didn't state but MUST have. Thank you!

harishs
Автор

I am doing my intern. I was stuck using the FutureBuilder widget since I have been not getting the output as expected. You telling us that we should not place the future inside the build AND showing us how to do it is what saved my Thank you so much man!!!!

heshankumarasinghe
Автор

You saved my time Sir. Because of you, I was able to solve a issue which I was scratching my head from last two days.
Simple way of explanation makes you a master of coding, as well as a master of teaching. Very rare people has both these qualities.

Thanks again!! Helping others is actually giving out positive energy in return you will get back Positive energy in some other ways.

unnisapp
Автор

Great video! You really understand what a less experienced developer might be confused about and explain what something is or does accordingly

victorschneider
Автор

9:39 As a tip for VSCode: if you press CTRL + . (control + period), while the cursor is on StatelessWidget, it should give the option to change to stateful widget.

michaeltolsma
Автор

"a piece of data that is of type Future. " Thank you

seyzeffects
Автор

Almost 4 years in flutter but didn't know that. Thanks!

verry_codes
Автор

Never had the build method issue but a good video to watch regardless. I find that exposing the future via a class that uses the provider package allows for really simple state management of all futures in the app and it won't recall every time the build method is triggered for any given widget

rohankapur
Автор

Thank you, a must-see for those who are starting to learn FutureBuilder, to avoid common mistakes

ruslanorolbaev
Автор

Hi Glove, your explanation is perfect about the issue when the the build process is retrigged .
I have another solution for this ; the technique is to bind a controller or service class to the screen (if its an mvc pattern) then make a fetching inside the initState() of this controller
For example I'm using the GetX microFramwork, so in the screen I created a variable like this :
UserController userFuture = Get.put(UserController());
In the User Controller I have a fetching function called GetCurrentUser() which I made a call of it the initState of the same controller
Now all I need is make : future : userFuture.getCurrentUser() and it's working fine .
After I saw your tuto I tried to make a test if it will trigger an issue and everything is working fine .
For me this technique may be optimal for performance especially for big projects
And Thank you again

wisemenjaja
Автор

@DevGrub great video in understanding FutureBuilder, in practical terms.

About the Dart Future type, it’s a container type that holds a value that should be available in the future, similar in fact to Futures in Scala.

So what happened was that, using async/await got the result of the first Future, and created a new Future containing that result.
You can get the same result with the original Future but, your example resolves the first Future, discards it and creates a new one holding the value of the first. So every time you reference the new Future, it will only contain the data, instead of making a database call, first.

victorigbokwe
Автор

Perfect, straight to the point, thank you!

MsPedroGomes
Автор

I was facing that refresh issue finally found the solution thanks to you.

aniketambre
Автор

Yeah, I have to agree, Some flutter documentations are vague and hard to parse, but thanks a lot man, this video was very helpful....

pranav-kale
Автор

Made my Day! Solved my issues in just 10 Min. God Bless You!🙂

iamsunnymac
Автор

Thank you so much for this tutorial, it probably saved me a fair amount of time of searching the forums for the solution.
Cheers to you, man!

dazai_dev
Автор

Genuinely wish there was a super like function on youtube just for this video. Thank you so much, I've been stuck on errors relating to this I didn't understand for the past two days.
How do you convert the Future type variable into the actual result you want to access and modify?

sophielee
Автор

Thanks bro, I was looking for a solution for the past God knows how many hours. You're a lifesaver!

ziku
Автор

Thanks. I was stuck with a flickering list, it is now fixed.

SumanBaul
Автор

Thanks Garrett, Super helpful .... I when straight to your video before augmenting my code with a FutureBuilder.

gerrywong