net / androidx.lifecycle / scopeLife
fun ViewModel.scopeLife(dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() ->Unit):AndroidScope
fun ViewModel.scopeLife(dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() ->
Unit
):
AndroidScope
在ViewModel被销毁时取消协程作用域