Closed Hard-Coder05 closed 3 years ago
Its better to move it to splash screen. In there, if the user is logged in, we can call the get_user_details api then and there. We can use provider to convey the User model object. But then cubit for profile will be useless. Think what you can do and lemme know.
I guess as the user logs in we should call the getUserProfile
that's a better approach according to me? What say?
I guess as the user logs in we should call the
getUserProfile
that's a better approach according to me? What say?
That should be the case when he's not logged in already. See, do this
in splash screen:
If user is logged in
get_user_details
redirect to homescreen
else
redirect to loginscreen:
when user logs in:
get_user_details
redirect to homescreen
ToDo:
Provider
with User
model just before the HomeScreen (whenever you redirect to homescreen, as you did for cubits)Provider.of<User>(context, listener: false)
in the ProfileScreen
Describe the bug
I require
name
andemail
for the sendFeedback function. So it is necessary that just after the user logs in the the profile data should get saved in the sharedPreferences.Basically we need to shift the getProfile function to menu.dart and save the response recieved in shared Preferences.
@werainkhatri sir! What say on this?