Tomas Ward
Tomas Ward

Reputation: 1164

How can I refresh an individual List Tile in a Listview.builder? Flutter

Situation:

  1. I have an 'Event' item that you can click on --> Event detail screen.
  2. That has individual subitems (date,participants,description) in the form of a list.
  3. I load the subitems with a Future Builder into a Listview.builder with a List Tile like so: enter image description here
  4. I have a button to edit the location, it saves to the database and locally updates the location variable. This calls SetState().
  5. The full list is updated, even if some tiles don't have changes.

THE PROBLEM Some tiles, like the participants tile needs to load pictures and some other things that are time intensive. So even if I just change the location and update the list, everything reloads, consuming resources and taking too much time to load a simple string.

WHAT I AM LOOKING FOR

Is it possible to reload only a certain list tile? Would you use another widget instead of ListView.builder? Other logic? Any help is appreciated.

Answer Extension [Update]

The marked answer is correct. I was using future builder and that was forcing me to reload all data always. By using different Streams with Streambuilder I am able to change data on database and it automatically changes on the UI, without updating the state! Magic.

Upvotes: 0

Views: 916

Answers (1)

Gbenga B Ayannuga
Gbenga B Ayannuga

Reputation: 2792

base on what i notices, Future Builder is the problem, Future builder rebuild the whole widget in the ListView.builder. in your case use StreamBuilder and you see the changes you what...

Upvotes: 2

Related Questions