Flutter Error: RangeError (index): Invalid value: Not in range 0..2, inclusive: 3

后端 未结 5 1797
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 00:49

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         


        
5条回答
  •  北荒
    北荒 (楼主)
    2021-02-05 01:21

    Widget getListView(){
      var itemList = getListElement();
       var list = ListView.builder(
         itemCount: itemList.length,
           itemBuilder:(context, index){
             return ListTile(
               title: Text(itemList[index]),   
             );
             }
       );
       return list;
    }
    

提交回复
热议问题