Flutter 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<String> list = getListItems();
ListView myList = new ListView.builder(
itemCount: list.length,
itemBuilder: (context, index) {
return new ListTile(
title: new Text(list[index]),
);
});
return myList;
}