0

I have the following list field in Firestore.

enter image description here

Now, I need to place value in seetsList[2].

FirebaseFirestore.instance.collection('Rooms').doc(widget.roomId).update({
   'seetsList': FieldValue.arrayUnion(?????????????????)
 });

Note: my listValue is always fixed with 5 index and peer index it has default value 0

Is this possible?

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
Mohammed Hamdan
  • 1,006
  • 5
  • 23

1 Answers1

1

There is no way you can update an element that exists in an array by its index. This means you’ll need to:

  • Read the content of the array into your application code.
  • Update the element in the array using the desired index.
  • Write the entire array back to Firestore.

This resource might also help.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193