yschimke
12/05/2021, 10:20 AMval taskSeries by viewModel.taskSeries(taskSeriesId).collectAsState(initial = null)
if (taskSeries != null) {
Text(text = taskSeries.name)
Didier Villevalois
12/05/2021, 10:52 AMtaskSeries
be not null during the first composition if you explicitely specify null
as an initial value for your collectAsState
?yschimke
12/05/2021, 11:10 AMif (taskSeries != null) {
check handles that, but this Text(text = taskSeries.name)
shows the error Smart cast to 'TaskSeries' is impossible, because 'taskSeries' is a property that has open or custom getter
Didier Villevalois
12/05/2021, 11:27 AMsindrenm
12/05/2021, 1:19 PMval
on the Compose side, you could get rid of the property delegate and just do this:
val taskSeries = viewModel.taskSeries(taskSeriesId).collectAsState(initial = null).value
That should help your smart casting along a little.