I am using a long list in flutter. All the items are rendering fine but also following error :
RangeError (index): Invalid value: Not in range 0..2, inclusive: 3
You should pass the itemCount
parameter to the ListView.builder
to allow it to know the item count
Widget getList() {
List list = getListItems();
ListView myList = new ListView.builder(
itemCount: list.length,
itemBuilder: (context, index) {
return new ListTile(
title: new Text(list[index]),
);
});
return myList;
}