Reputation: 51
i'm developing an app with user system, my user data stores location information and with this information im showing data to user also i have a profile page.
i'm struggling figure out the fundamental of model system. The thing that i want to do is login to an account and retrieve all data and keep the data in the system. when i logged in store all my data somewhere and use that data from all pages.
im doing this task by retrieve data on every page is loaded.(when homepage is loaded, retrieve user data, when profile page is loaded retrieve user data. i dont think this is the right or efficient way.
LONG STORY SHORT
how to retrieve user data when logged in and use that same data on all of my pages(im retrieving data on every page)
Upvotes: 0
Views: 500
Reputation: 107
if you use Cloud Firestore then use
final FirebaseAuth _auth = FirebaseAuth.instance;
getCurrentUser() async {
final FirebaseUser user = await _auth.currentUser();
final uid = user.uid;
final uemail = user.email;
print(uid);
print(uemail);
}
Upvotes: 0