getCartItems method

Stream<List<CartItem>> getCartItems()

Retrieves a stream of the user's cart items from Firestore.

Returns: A Stream<List<CartItem>> containing the user's cart items.

Implementation

Stream<List<CartItem>> getCartItems() {
  return _firestore
      .collection('carts')
      .doc(userId)
      .collection('items')
      .snapshots()
      .map((snapshot) =>
          snapshot.docs.map((doc) => CartItem.fromMap(doc.data())).toList());
}