I have the following App in Flutter (please see attached image):
- A parent screen, showing a list of products, as queried from Firestore collection, using Stream Subscription (so that if the data changes, it's reflected in that screen)
- A child screen, showing a selected product (data from a Firestore document). If the data in this document changes (price change for example), this screen should show the updated data
I can achieve this using Stream subscription to the products collection for the parent screen, and stream subscription to the product document for the child screen.
But I guess that I can utilize provider for this, and use a smarter way of doing so (updates to the data in the parent screen reflected in the child screen)...
As someone new to Provider, I'd love to hear (see a code snippet) how to do that?
EDIT:
I know I can use stream provider to get the "products" part.
I guess my question is: after I get updated with the products list in the parent screen (using StreamProvider), how do I store the selected product data in the parent screen, so that is available (and notify on changes) in the child screen?
