Troy Perales
04/19/2024, 1:20 AMvar
of type Job
to some “no-op” value to avoid having a nullable type?Troy Perales
04/19/2024, 1:22 AMvar job = scope.launch {}
jw
04/19/2024, 1:27 AMnull
seems a pretty good candidate though.
You can also just call Job()
to get an active-yet-detached instance.Troy Perales
04/19/2024, 1:33 AMvar inactiveTimeout: Job? by rememberRetained { mutableStateOf(null) }
...
//"Smart cast to 'Job' is impossible.."
if (inactiveTimeout != null && !inactiveTimeout.isActive) {
...
Maybe it’s just my aversion to safe calls I need to get over. Seen too many apps with them littered all over.jw
04/19/2024, 1:37 AMjw
04/19/2024, 1:38 AMephemient
04/19/2024, 7:59 AMif (inactiveTimeout?.isActive == false) {