title: How to access array index of Cloud Firestore using query in Flutter?
body: <p>I have field <code>users</code> in document and this field contains two element in array. I have to check specific two values are in this array.</p>
  
  <p>First, I used <code>array-contains</code> method twice for this, but it occurred error.</p>
  
  <p>How can I access index of array field in Cloud Firestore? </p>
  
  <p>Below code is my approach and it is not working:</p>
  
  <pre><code>QuerySnapshot querySnapshot = await sl.get&lt;FirebaseAPI&gt;().getFirestore()
        .collection('messages')
        .where('users'[0],isEqualTo: 'user1ID')
        .where('users'[1],isEqualTo: 'user2ID')
        .getDocuments();
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/E9DwV.png" rel="nofollow noreferrer">simple firestore structure</a></p>