3

I am using the firebase_auth package to implement the authentication functionality in my flutter application and for auto-login of user I need a response from FirebaseAuth.instance.currentUser() which is always returning null. They have a Github issue here but it is closed and not have much details.

Here is the link to package description. Do I need to migrate my project to AndroidX to make things work? Is there any other way to make all of this work without migrating a project to AndroidX?

3 Answers 3

3

after the update you can use it like this

FirebaseAuth.instance.currentUser

instead of FirebaseAuth.instance.currentUser()

this will fix the issue

Sign up to request clarification or add additional context in comments.

Comments

0

Use this

User? user = FirebaseAuth.instance.currentUser ;

Comments

0

final user = FirebaseAuth.instance.currentUser; then use the user with id like user.userId

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.