I'm trying to save a user in the repository with a method, when I set the document id as the current user id logged in it gives me this error
user.getUid can only be called from within the same library group (groupId=com.google.firebase)
class FirebaseRepository {
var db = FirebaseFirestore.getInstance()
var auth = FirebaseAuth.getInstance()
var user = auth.currentUser
fun saveUser(user: User): Task<Void>{
var documentReference = db.collection("users").document(user.uid).set(user)
}
}
But when I do set the variable var user = auth.currentUser
inside the method works.
Question: What's going on there? What am I missing?
Solution: I didn't notice there were 2 user variables (Class variable and method variable), I was using the method variable instead the auth variable.