How to use StreamProvider with minimal widget re-build and firestore read?
477
With Provider, you can use Consumer and Selector to avoid unnecessarily rebuilds.
https://pub.dev/documentation/provider/latest/
Comments
-
leemuljadi over 1 year
I want to
StreamProvider
to pass myUserData
object through out all the widgets, so it can be accessible anywhere.The
UserData
object is taken/read from the Firestore database.My questions are:
- How can I use StreamProvider properly/efficiently so it will minimize the widget rebuild and read from Firestore (cause Firebase bills per every document read, CMIIW)?
- Should I use FutureProvider instead? But I want the UI also be able to be updated when there is change in the database.