hoanghm / Proact

2 stars 0 forks source link

Use Flutter Provider to maintain a constant reference to User #73

Open PersonaUnknown opened 4 months ago

PersonaUnknown commented 4 months ago

The User table in Firebase has converter class ProactUser. At the moment, fetching the ProactUser data for the current user requires constantly fetching this information repeatedly for each new widget. Flutter Provider is like the useContext hook from React to allow persistent information to be shareable amongst all listening widgets (meaning we only need to fetch ProactUser once).

TLDR: Use Flutter Provider to create a Consumer to be listened by any widgets we want.