ribesg
06/02/2023, 10:46 AMSmart cast to 'X' is impossible, because 'x' is a property that has open or custom getter
? I usually do val x = x
locally but then I get a name shadowing warning. I don't really like having to find another name just because I have a custom getter. What would be a clean solution?Sam
06/02/2023, 10:51 AM.let
can be helpful, and (I think) won’t produce the warning:
x?.let { x -> ... }
ribesg
06/02/2023, 10:57 AMcity?.let { city ->
Text(city.name)
Text(city.country)
} ?: run {
Text("…")
}
val city = city // I'd rather not do that
if (city == null) {
Text("…")
} else {
Text(city.name)
Text(city.country)
}
hallvard
06/02/2023, 11:13 AMval x = x
line.Sam
06/02/2023, 11:21 AMx
as a parameterephemient
06/02/2023, 1:26 PM