Rohan Maity
03/03/2023, 10:06 AMprivate fun CoroutineScope?.launchWithNullCheck(
        block: suspend () -> Unit
    ) {
        this?.let {
            Log.d("FUI", "Scope not null")
            val job = launch {
                Log.d("FUI", "executing block not null")
                block()
            }
            Log.d("FUI", "job isActive ${job.isActive}, isCompleted: ${job.isCompleted}, isCancelled: ${job.isCancelled}")
        }
}Sam
03/03/2023, 10:10 AMCoroutineScopeJobRohan Maity
03/03/2023, 10:11 AMLaunching a job as a child of a cancelled job will immediately return a cancelled jobLet me verify this and give more information
Rohan Maity
03/03/2023, 10:18 AMSam
03/03/2023, 10:19 AMthis?.coroutineContext?.jobthisRohan Maity
03/03/2023, 10:24 AMprivate fun CoroutineScope?.launchWithNullCheck(
        block: suspend () -> Unit
    ) {
        this?.let {
            Log.d("FUI", "scope isActive: ${this.isActive}")
            Log.d("FUI", "existing job cancelled: ${coroutineContext.job.isCancelled}")
            Log.d("FUI", "Scope not null")
            val job = launch {
                Log.d("FUI", "executing block not null")
                block()
            }
            Log.d("FUI", "job isActive ${job.isActive}, isCompleted: ${job.isCompleted}, isCancelled: ${job.isCancelled}")
        }
}Rohan Maity
03/03/2023, 10:24 AMSam
03/03/2023, 10:26 AMRohan Maity
03/03/2023, 10:28 AMviewmodelscopeSam
03/03/2023, 10:29 AMViewModelRohan Maity
03/03/2023, 10:29 AMSam
03/03/2023, 10:32 AMViewModelScopeRohan Maity
03/08/2023, 10:32 AMviewModelScopeRohan Maity
03/08/2023, 10:33 AM