Reputation: 571
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>>
Upvotes: 0
Views: 1348
Reputation: 1221
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.
Upvotes: 1