0

How can I pass data from one screen to another as a stream?

I have a screen showing list of products using Firebase Stream (StreamProvider) when I click on a product I want to go to anther screen where I can display the product details. I want to pass the list of products to the details page as stream so any changes I make on the details screen will automatically update the firestore document.

    onTap: () {
                  Navigator.push(
                      context,
                      MaterialPageRoute(
                          builder: (context) => ProductDetails(
                                products: products
                              )));
                },

On the product details screen I can only get the products as List<Product> instead of Stream<List<Product>>

Huzzi
  • 561
  • 2
  • 7
  • 21

1 Answers1

1

In Flutter the way to send data to a new screen is described here.

However, I found this SO post which might seem helpful for your use-case.

You may try BLoC implementation here. Furthermore, I came across this Medium article that might shed some light on this issue.

  • That's helpful, thanks for that. I think BLoC might be the solution for my problem and I'm looking into it. – Huzzi Sep 22 '20 at 08:35