skip to content

Paged & Infinite Lists

An infinite list loads the next page as the scroll nears its end, shows a loading footer, and refreshes on pull without losing the user's place. Interviewers probe duplicate fetches and jumps.

part ofFlutteroverview, primer and where to startread it →
on this pageshow

explore

questions

4

In a Flutter infinite ListView, why can one scroll fire several requests for the same page, and how do you prevent it?

level: middleimportance: must knowfreq 50%

basics

~20 s

The scroll listener fires on every offset change and extentAfter stays under the threshold while the request runs, so each event starts another fetch. Set an in-flight flag synchronously before the first await, and discard responses from before a refresh.

open as a page

In Flutter, how does RefreshIndicator's onRefresh work, and why might the pull-to-refresh spinner never appear or vanish at once?

level: juniorimportance: should knowfreq 44%

basics

~20 s

RefreshIndicator calls onRefresh, a Future<void> Function(), and keeps the spinner until that future completes. It vanishes at once if the work is not awaited, and never appears if the child cannot overscroll, such as a short list.

open as a page

A Flutter job feed jumps to the top on every reload and shifts when new postings are prepended; how do you keep the user's scroll position?

level: seniorimportance: should knowfreq 28%

basics

~20 s

Keep the list mounted during reloads instead of swapping it for a spinner, because a new scroll position starts at initialScrollOffset. For prepended items, use a CustomScrollView whose center is the existing items' sliver, so new items grow upward without moving the view.

open as a page