'Flutter Firestore create new Array every time function called

As per the question I'd like to add a new array every time I call my addPredection function for example I'd like it to look like this.

Currently its just updating the current value everytime

enter image description here

My code is as follows:

///add prediction function
  Future<String?> addPrediction() async {
    var currentUser = FirebaseAuth.instance.currentUser;
    var todaysDate = DateTime.now().toString();


    var doesExist = await FirebaseFirestore.instance
        .collection('collection')
        .doc(currentUser!.uid)
        .get();
    if (doesExist.exists == true) {
      FirebaseFirestore.instance
          .collection('userMoods')
          .doc(currentUser!.uid)
          .update({
        'Predictions':
        FieldValue.arrayUnion([todaysDate,'angry', 'Happy'])
      });
    }
    if (doesExist.exists == false) {
      FirebaseFirestore.instance
          .collection('userMoods')
          .doc(currentUser!.uid)
          .set({
        todaysDate: FieldValue.arrayUnion(['angry', 'Happy'])
      }, SetOptions(merge: false));
    }


Sources

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

Source: Stack Overflow

Solution Source