I want to implement a class with two constrcutors. And empty constructor and another with a param user:FirebaseUser
But i'm getting the message error:
"There is a cycle in the delegation change"
class UserModel(user: FirebaseUser) {
var uid: String?
val email: String?
val phoneNumber: String?
val photoUrl: String
val displayName: String?
//error message: There is a cycle in the delegation change
constructor():this() {}
init {
this.displayName = user.displayName
this.email = user.email
this.phoneNumber = user.phoneNumber
this.photoUrl = user.photoUrl!!.toString()
this.uid = user.uid
}
companion object {
@Exclude
val CURRENT_LOCATION = "location"
}
}
I've tried several approaches without success. Any help?