here i have a code to update my firestore database here 'm' is a list of document id's,and 'a' is a list of numbers and 'b' is a list of boolean values , all the lenght of lists are same.
if below method is wrong please give me an example to updated 50 documents in one batch
void onpressed() async{
alert('updating');
WriteBatch batch= Firestore.instance.batch();
int i=0;
while(b[i]){
batch.updateData(Firestore.instance.collection("allstu").document("17csea").collection("17csea").document(m[i]), {"attendance": a[i]+1});
i++;
}
await batch.commit().then((value){
alert("update successful");
}
).catchError((err){
alert("Something went wrong try again");
});
}
i dont know why its not updating i have a list of 50 document ids and iam trying to update only some documents in a list(selected by user).that is update with loop checking the codintion of while using B[i] here B is list of boolean values so that only reuired dcouments are added to batch.ausume a[i]+1 is a integer
if above method is wrong please give me an example to updated 50 documents in one batch