I am using a ChangeNotifierProxyProvider to provide a class called DatabaseService. The provider is shown below
ChangeNotifierProxyProvider<AuthService, DatabaseService>(
create:(_)=> DatabaseService() ,
update: (_,AuthService authService, DatabaseService databaseService)=> databaseService..update(authService.currentUserId),
),
Here is the update function in DatabaseService
void update (String uid)async {
if(uid==this.uid) return;
this.uid=uid;
notifyListeners();
print("USER ID IS : " + uid); }
When a user logs in, the Database class successfully gets the uid, and calling Provider.of(context).uid works fine. The problem is that when I refresh the app, the uid resets back to its default value. How can I prevent the value from resetting after refreshing the app.