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
if you are using StreamBuilder
then you must use this line of code
StreamBuilder(
stream: FirebaseFirestore.instance.collection("Tooth")
.orderBy("date", descending: false).snapshots() ,
builder: (BuildContext context, AsyncSnapshot snapshot){
if(snapshot.hasData)
{
return ListView.builder(
itemCount: snapshot.data.docs.length,
padding: const EdgeInsets.only( top: 20.0),
itemBuilder: (BuildContext context, int index) {
DocumentSnapshot ds = snapshot.data.docs[index];
},
);
}
},
),