All in one Flutter Resource: https://flatteredwithflutter.com/
In my previous post, Future Builder (part one), we were able to call a future asynchronously and render the widget upon the response from the api call.
However, I was not able to make the future builder call upon an event listener. For instance, you may require that a api to be called on button click (async) and render the result on the UI (async).
That’s why this part two is introduced…..
So, in this program (at the bottom), I have implemented a future which will be called on the button click. Until then, the text widget appears with default value (“no data yet”).
As soon as response is returned, builder part of the future gets called which renders the text widget with the response.
In my program, I have called below api :
(All programming failures keeping with myself. :p)…
For complete source code, please refer below :
The Flutter Pub is a medium publication to bring you the latest and amazing resources such as articles, videos, codes, podcasts etc. about this great technology to teach you how to build beautiful apps with it. You can find us on Facebook, Twitter, and Medium or learn more about us here. We’d love to connect! And if you are a writer interested in writing for us, then you can do so through these guidelines.