How can I set values to Firestore from a list

I am trying to make a grading app and I wanted to list students from Firestore and fill their grades and I have got the list for the students list but I cant get the number to work I have a working attendance code that only uses boolean values here is the working code for booleans

Switch(
                                  value: switchStates[
                                      students[index].data()["id"]],
                                  onChanged: (value) {
                                    setState(() {
                                      stateofvalue = value;
                                    });
                                    onSwitchChanged(
                                        students[index].data()["id"], value);
                                  },
                                  activeColor: Color(0xff2fbd9f),
                                ),

this is how I call the values

    CollectionReference users = FirebaseFirestore.instance.collection('users');
Future<void> markAttendance() {
    Map<String, dynamic> resultMap = {};
    var formatter = new DateFormat('dd-MM-yyyy');
    String todaysDate = formatter.format(now);

    switchStates.forEach((key, value) {
      keys.add(key);
      values.add(value);
    });
    for (var i = 0; i < keys.length; i++) {
      resultMap["${keys[i]}"] = values[i];
    }
    FirebaseFirestore.instance
        .collection("data")
        .doc("attendance")
        .collection("school")
        .doc(todaysDate)
        .set(resultMap);
  }

and this is how I set th value but now I want to set grades in the same manner how can I manage to do that by replacing Switch() with TextFeild()