bohregard
11/11/2021, 8:21 PM"Attempt to invoke interface method 'java.lang.Object androidx.compose.runtime.State.getValue()' on a null object reference
.
data class ActivationResponder(
val id: Long,
val firstName: String,
val lastName: String,
@SerializedName("callSign")
val callsign: String,
val phoneNumber: String,
) {
var isChecked: Boolean by mutableStateOf(false)
val name: String
get() = "$firstName $lastName"
}
Any insight on to why that would be the case?bohregard
11/11/2021, 8:32 PMval responders = activateApi.getAvailableResponders(activationId).map {
ActivationResponder(
callsign = it.callsign,
id = it.id,
firstName = it.firstName,
lastName = it.lastName,
)
}
Zach Klippenstein (he/him) [MOD]
11/12/2021, 6:47 PMbohregard
11/12/2021, 9:31 PMAbhinav Suthar
11/13/2021, 7:53 PMdata class Foo(val x: Any){
val y = "some string"
init{
Log.d(TAG, message)
}
}
If you create object of this class using gson then the log statement will not be printed. It seems like that class object created with gson doesn't calls init fun and so isChecked is not initialised. It has nothing to do with by
delegate.
Even y
variable will be null.