title: Flutter & Firebase: How to check if an item exists inside of an array within a Firebase document
body: <p><a href="https://i.stack.imgur.com/2aL80.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2aL80.png" alt="img_firebase" /></a></p>
  <p>I'm trying to waitUser(array) check exist value how can I?</p>
  <p>// if <em><strong>waitUser array field</strong></em> exist <strong>2</strong> return text(&quot;this text&quot;) else return text(&quot;other text&quot;)</p>
  <pre><code>      body: StreamBuilder(
      stream: FirebaseFirestore.instance
          .collection('events')
          .where('eventCity', isEqualTo: 'Ankara')
          .snapshots(),
      builder: (BuildContext context, AsyncSnapshot&lt;QuerySnapshot&gt; snapshot) {
        if (!snapshot.hasData) {
          // ERROR
          return Center(
            child: CircularProgressIndicator(),
          );
        } else {
          return Container(
            child: ListView(
              scrollDirection: Axis.vertical,
              children: snapshot.data.docs.map((document) {
                // if waitUser array field exist 2 return text(&quot;this text&quot;) else return text(&quot;other text&quot;)
              }).toList(),
            ),
          );
        }
      },
    ),
  </code></pre>