title: Flutter Firestore - How to get data from a Document Reference in a Document Field?
body: <p>I'm building a Self-learning app with differente questions types. Right now, one of the questions have a field containing a list of DocumentReferences:</p>
  <p><a href="https://i.stack.imgur.com/rvNHO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rvNHO.jpg" alt="enter image description here" /></a></p>
  <p>In Flutter, I have the following code:</p>
  <pre><code>Query&lt;Map&lt;String, dynamic&gt;&gt; questionsRef = firestore
  .collection('questions')
  .where('lesson_id', isEqualTo: lessonId);
  
  await questionsRef.get().then((snapshot) {
    snapshot.docs.forEach((document) {
      var questionTemp;
      switch (document.data()['question_type']) {
  
  
        ....
  
  
  
        case 'cards':
          questionTemp = CardsQuestionModel.fromJson(document.data());
          break;
  
  
        ....
  
  
      }
      questionTemp.id = document.id;
      questions.add(questionTemp);
    });
  });
  </code></pre>
  <p>Now, with &quot;questionTemp&quot; I can access all the fields (lesson_id,options,question_type, etc..), but when it comes to the &quot;cards&quot; field, how Can I access the data from that document reference?</p>
  <p>Is there a way to tell firestore.instance to get the data from those references automatically? Or do I need to make a new call for each one? and, if so, how can I do that?</p>
  <p>Thank you for your support in advance!</p>