'Make a Stream able to grab datas from Cloud Firestore Flutter

I want to get datas from a collection of my cloud firestore database. I tried with a stream but it seems that it doesn't work as I'm unable to print those datas on the console and to fetch them on screen. Did I do something wrong?

Stream<List<ProductModel>> getAllProducts() =>
      firebaseFirestore.collection("products").snapshots().map((query) =>
          query.docs.map((item) => ProductModel.fromMap(item.data())).toList());

In case you want to know, Here is my ProductModel class, which contains the same properties asmy firestore collection

class ProductModel {
  static const ID = "id";
  static const IMAGE = "image";
  static const NAME = "name";
  static const BRAND = "brand";
  static const PRICE = "price";

  String? id;
  String? image;
  String? name;
  String? brand;
  double? price;

  ProductModel(
      {required this.id,
      required this.image,
      required this.name,
      required this.brand,
      required this.price});

  ProductModel.fromMap(Map<String, dynamic> data) {
    id = data[ID];
    image = data[IMAGE];
    name = data[NAME];
    brand = data[BRAND];
    price = data[PRICE].toDouble();
  }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source