RangeError (index): Invalid value: Valid value range is empty: 0

后端 未结 8 2032
没有蜡笔的小新
没有蜡笔的小新 2021-02-12 13:26
Widget build(context) {
    try{
      if (isFirst == true) {
        fetchImage();
        fetchCategories(context);
        isFirst = false;
      }
    }catch(Excepti         


        
8条回答
  •  感情败类
    2021-02-12 13:36

    Make sure specifying the length of the list of data. For example, if you're using ListView.builder give proper value to the attribute itemCount.

    ListView.builder(
                itemCount: snapshot.data.length,
                itemBuilder: (ctx, index) {
                  return WidgetItem();
                });
    

提交回复
热议问题