title: "native "AssertionError_throwNew" " error with Firebase Firestore
body: <p>I have this function that checks if a document exists or not, if exists returns true otherwise false :</p>
  <pre><code>Future&lt;bool&gt; checkMissingId(String id) async {
  
    String str = id.toLowerCase();
    String letter = str[0];
    String path = letter + &quot;/&quot; + str;
  
    try {
      final snapShot =
          await FirebaseFirestore.instance.collection(path).doc(str).get();
  
      if (snapShot == null || !snapShot.exists) {
        return true;
      } else
        return false;
    } catch (e) {
      print(e);
      return false;
         }
      }
  </code></pre>
  <p>But when I call it from here (after save and validate form ) :</p>
  <pre><code> Future&lt;void&gt; _submit() async {
      //Create Artist and send it to the database
      if (_validateAndSaveForm()) {
        await checkMissingId(userNameF);
      }
  }
  </code></pre>
  <p>All freezes and it opens a new file called &quot;errors_patch.dart&quot; with this exception :</p>
  <pre><code>static _doThrowNew(int assertionStart, int assertionEnd, Object? message)
        native &quot;AssertionError_throwNew&quot;;
  </code></pre>
  <p>I think the problem is that checkMissingId is of type Future and maybe I'm not handling futures in the right way...But the error highlights also <code>await FirebaseFirestore.instance.collection(path).doc(str).get();</code> so I don't know exactly how isolate the problem.
  This is the stack :</p>
  <pre><code>assert(isValidCollectionPath(collectionPath),
  
  await FirebaseFirestore.instance.collection(path).doc(str).get();
   with a red quotes : 
  
  _AssertionError ('package:cloud_firestore/src/firestore.dart': Failed assertion: line 74 pos 12: 'isValidCollectionPath(collectionPath)': a collection path must point to a valid collection.)
   await checkMissingId(userNameF);
  </code></pre>
  <p>Maybe it depends by wrong document path from Firestore?</p>