title: flutter : update list in firestore by cloud function
body: <p>I'm trying to update list in document but it replace all data with the new ,, I only want to add items without delete old list data</p>
  <p><a href="https://i.stack.imgur.com/zPnhH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zPnhH.jpg" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/GpSFR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GpSFR.jpg" alt="enter image description here" /></a></p>
  <p>this my code:</p>
  <pre><code>const functions = require('firebase-functions');
  
  const admin = require('firebase-admin');
  admin.initializeApp();
  
  exports.setUsername = functions.https.onCall((data, context) =&gt; {
      const documentRef = admin.firestore().collection('userInfo').doc(data);
      return documentRef.get()
          .then((doc) =&gt; {
              if (doc.exists) {
                  return documentRef.update({'list': ['item3']});// here update
              } else {
                   return { result: &quot;Doc not found!&quot; };
              }
          })
          .catch(err =&gt; {
              console.log(&quot;Error: &quot;, err)
          });
  });
  </code></pre>