title: How to check if string already exists in list?
body: <p>Im trying to create a list of string which has array from firebase . And that works perfectly. But now I wanna filter the list a bit . So what I want is add allhastags one time . So if a hashtags exist twice I wanna just put it int he list once. Heres my code</p>
  <pre><code>
    Future&lt;List&lt;String&gt;&gt; getHashtags() async {
      List&lt;String&gt; allVideoHastags = [];
  
      QuerySnapshot snapshots =
          await FirebaseFirestore.instance.collection('videos').get();
  
      for (QueryDocumentSnapshot videoSnapshot in snapshots.docs) {
        List&lt;String&gt; videoHastags =
            List.from(videoSnapshot.data()['Hashtagsforallvideos']);
        allVideoHastags.addAll(videoHastags);
      }
      _allResults = allVideoHastags;
       searchResults();
     
      return allVideoHastags;
    }
  </code></pre>
  <p>So before adding the hashtags into the list ,I wanna check if it already exists in the list of strings .Hope anyone can help .If you need more information please leave a comment</p>