Index
net / com.drake.net.utils
Package com.drake.net.utils
Types
Name |
Summary |
SavedViewModel |
继承这个类可以快速创建具备saveInstance的ViewModelopen class SavedViewModel : ViewModel |
Extensions for External Classes
Functions
Name |
Summary |
runMain |
在主线程运行fun runMain(block: () -> Unit ): Unit |
scope |
异步作用域fun scope(dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit ): AndroidScope |
scopeNet |
网络请求的异步作用域 自动显示错误信息吐司fun scopeNet(dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit ): NetCoroutineScope |
withDefault |
切换到默认调度器suspend fun <T> withDefault(block: suspend CoroutineScope.() -> T): T |
withIO |
切换到IO程调度器suspend fun <T> withIO(block: suspend CoroutineScope.() -> T): T |
withMain |
切换到主线程调度器suspend fun <T> withMain(block: suspend CoroutineScope.() -> T): T |
withUnconfined |
切换到没有限制的调度器suspend fun <T> withUnconfined(block: suspend CoroutineScope.() -> T): T |