Learning Flutter Widgets, Widget 6 – FutureBuilder

FutureBuilder<T> class

Widget that builds itself based on the latest snapshot of interaction with a Future.

The future must have been obtained earlier, e.g. during State.initStateState.didUpdateWidget, or State.didChangeDependencies. It must not be created during the State.build or StatelessWidget.build method call when constructing the FutureBuilder. If the future is created at the same time as the FutureBuilder, then every time the FutureBuilder‘s parent is rebuilt, the asynchronous task will be restarted.

A general guideline is to assume that every build the method could get called every frame, and to treat omitted calls as an optimization.

Source Website: api.flutter.dev

https://api.flutter.dev/flutter/widgets/FutureBuilder-class.html

Previous Post
Next Post

Leave a Reply

Your email address will not be published. Required fields are marked *