title: Flutter Firestore query 2 collections
body: <p><strong>Question is updated</strong></p>
  
  <p>How would I query 2 collections? I have a wishlist collection where each wishlist document looks like this:</p>
  
  <pre><code>documentID: "some-wishlist-id",
  modified: "1564061309920",
  productId: "2tqXaLUDy1IjxLafIu9O",
  userId: "0uM7Dt286JYK6q8iLFyF4tG9cK53"
  </code></pre>
  
  <p>And a product collection where each product document looks like this. The productId in the wishlist collection would be a documentID in the product collection:</p>
  
  <pre><code>documentID: "2tqXaLUDy1IjxLafIu9O",
  dateCreated: "1563820643577",
  description: "This is a description for Product 9",
  images: ["some_image.jpg"],
  isNegotiable: true,
  isSold: false,
  rentPrice: 200,
  sellPrice: 410,
  title: "Product 9",
  totalWishLists: 0,
  userId: "0uM7Dt286JYK6q8iLFyF4tG9cK53"
  </code></pre>
  
  <p><strong>NOTE: To be clear, the wishlist query should return a list of documents that I need to iterate over to retrieve the product.</strong></p>
  
  <p>Not sure if I need to use streams or futures in this case, but this is what I have so far:</p>
  
  <pre><code>Future&lt;Product&gt; getProduct(String documentId) {
  return Firestore.instance
      .collection(APIPath.products())
      .document(documentId)
      .get()
      .then((DocumentSnapshot ds) =&gt; Product.fromMap(ds.data));
  }
  
  Query getWishListByUser(userId) {
      return Firestore.instance
          .collection(APIPath.wishlists())
          .where('userId', isEqualTo: userId);
  }
  
  Future&lt;List&lt;Product&gt;&gt; getProductsWishList(userId) async {
      List&lt;Product&gt; _products = [];
  
      await getWishListByUser(userId)
          .snapshots()
          .forEach((QuerySnapshot snapshot) {
        snapshot.documents.forEach((DocumentSnapshot snapshot) async {
          Map&lt;String, dynamic&gt; map = Map.from(snapshot.data);
          map.addAll({
            'documentID': snapshot.documentID,
          });
  
          WishList wishList = WishList.fromMap(map);
  
          await getProduct(wishList.productId).then((Product product) {
            print(product.title); // This is printing
            _products.add(product);
          });
        });
      });
  
      // This is not printing
      print(_products);
  
      return _products;
    }
  </code></pre>
  
  <p>Thanks</p>