0

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)

1
  • Use provider to retrieve user data . or use SharedPrefarence to store and retrive data Commented Mar 2, 2022 at 4:15

1 Answer 1

0

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);
  }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.