0

I have a reversed listview.builder() that I need to start at a certain index, tried scrollController but, didn't work as it began from certain index but from bottom.

Code

ScrollController scrollController = ScrollController(
    initialScrollOffset: 10,
    keepScrollOffset: true,
  );

return ListView.builder(
      controller: scrollController,
      reverse: true,
      shrinkWrap: true,
      itemCount: snapshot.data.documents.length,
      itemBuilder: (context, i) {
        ................
  • in the item count property subtract from where you want to start your index , as you allready reversed it this will work for you. Ex : (snapshot.data.documents.length-2) this may help you. – UTKARSH Sharma Oct 01 '20 at 07:50
  • but I want every document to bee built. – FlutterDeveloper11 Oct 01 '20 at 08:05
  • The ScrollablePositionedListView seems working, it does jump to certain index but it renders the same List under it, weird, right ? and if I restarted it doesn't work. – FlutterDeveloper11 Oct 01 '20 at 09:02
  • I figured it out with listView.builder(), it does go to my index with animateto() but, after I go to another screen and come back, it gives me this error: `'package:flutter/src/widgets/scroll_activity.dart': Failed assertion: line 613 pos 15: 'to != null': is not true.` – FlutterDeveloper11 Oct 02 '20 at 06:21
  • Set Initial `initialScrollIndex` programmatically using the scrollable_positioned_list package . – Amfstacks Mar 31 '23 at 06:47

0 Answers0