Class is missing a constructor with no arguments - but I've provided a constructor

前端 未结 3 1315
孤城傲影
孤城傲影 2020-12-22 06:45

I am trying to retrieve the user\'s info after they log in from Firebase. I have the sneaking suspicion that this error isn\'t actually my problem - and has to deal with the

3条回答
  •  攒了一身酷
    2020-12-22 07:36

    If all primary constructor parameters have default values, Kotlin will generate a parameterless constructor as well. In your case DateJoined is missing one. So

    data class User(
            var FirstName: String = "",
            var LastName: String = "",
            var Email: String = "",
            var Password: String = "",
            var DateJoined: ... = ...
    )
    

    (I don't know which types are allowed for fields in FireBase, but Any probably isn't one and if it is it can't be efficient.)

提交回复
热议问题