i am building an app with firebaseauth and firebasestore. On the startup I am storing a constant value of the current user. From the uid it takes the id and gets the object out of the firebasestore database for more user data.
CustomUserData.withData({
required this.uid,
required this.firstname,
required this.lastname,
required this.birthday,
required this.shortname,
required this.rawData,
required this.isPassive,
required this.lastLogin,
required this.role,
required this.buildNumber,
This my CustomuserData class.
Now I want to store this object as a provider from riverpod. But I don’t know how to set this value on the startup to listens in the whole app after ist.
Currently I am always accessing my static variable.
Do you know any working solution ?
2
Answers
You can do that. Simply wrap your MaterialApp or whatever your top level widget is with the provider.
My app is using providers from provider package, but should be same for riverpod as well.
you can try it so: