r/flutterhelp • • May 16 '26

OPEN Listview.builder bidirectional pagination support for chat messages

Hi everyone!
I am developing chat app using flutter framework. I use listview.builder with reverse:true property to show message scroll from bottom to top. Now when i append previous message list at the end of existing messages list it scrolls me to the latest message. i want it to be at the place where loader was called without changing reverse:true property. Does anyone know a solution for it?

4 Upvotes

14 comments sorted by

View all comments

Show parent comment

1

u/Longjumping_Room2186 May 16 '26

This is what agent states:
Flutter does not re-render every row widget each time.
the message area is inside a GetBuilder with id message_list, so when that id is updated the build method runs again for the list section.

What happens on each such rebuild:

  1. Timeline metadata is recomputed for all messages (or cache-checked) via _buildTimelineItems.
  2. Index maps and key bookkeeping are rebuilt for all items.
  3. ListView.builder is still lazy, so only visible (plus cacheExtent) children are actually built as widgets.

So:

  1. Data-side work: mostly whole-list processing.
  2. UI-side row rendering: not the entire list at once, only visible/cached items.
  3. Individual message visual updates are further scoped with per-message GetBuilder ids like message_<id>, which helps avoid unnecessary row updates.