'How to batch update arrays?

So I am creating an attendance app in which there is a list named attendees which contains the list of all students attending the lecture.

List<String> attendees = [uid0, uid1, uid2];

and the student data model is as follows

Student(
List<String> attendance = [at0, at1]; //this is the list of lectures attended
String name;
)

and the document name of every student is their user-id
How do I update the list of every student via the batch() function?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source