Flutter Package anchored_list Enables O(1) Index Jumps in Million-Item Lazy Lists
A new Flutter package called anchored_list solves the long-standing problem of jumping to an arbitrary index in a large lazy list without building all preceding items. It works by splitting the list into two slivers at a chosen anchor index, placing earlier items at negative scroll offsets so the viewport starts exactly at the target. This approach makes jumping to any index — such as row 842,013 in a million-item list — as cheap as jumping to row 3, achieving true O(1) performance. The method also prevents scroll position from shifting when new items are inserted above the current view, making it well-suited for chats, feeds, and logs. Existing popular packages like scrollable_positioned_list and scroll_to_index, which together still exceed a million monthly downloads, are both effectively unmaintained, highlighting a gap this package aims to fill.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in