title: flutter / dart How can check if a document exists in firestore?
body: <p>I try to query using a bool if a document exists on the cloudfirestore or not. Unfortunately, my code does not work</p>
  
  <p>I tried the following, but the bool does not change.</p>
  
  <pre><code>getok() {
    bool ok;
    Firestore.instance.document('collection/$name').get().then((onexist){
        onexist.exists ? ok = true : ok = false;
      }
    ); 
    if (ok = true) {
      print('exist');
    } else {
      print('Error');
    }
  }
  </code></pre>