Jordaninho
Jordaninho

Reputation: 185

Use same future for several FutureBuilder

In my page I have many FutureBuilder that share the same data from a future. As the future is a request from Firebase, I just want to do it one time. Do you have a solution ?

Upvotes: 0

Views: 36

Answers (1)

Cavin Macwan
Cavin Macwan

Reputation: 1238

Whenever you FutureBuilder calls the future, you can store its value inside a variable.

After that, you can pass that variable in your widgets via the constructor or if you are in the same stateful widget then you can directly assign it via setstate method.

Upvotes: 1

Related Questions