Package-level declarations
Types
Link copied to clipboard
Link copied to clipboard
expect class LifecycleOwnerDelegate : LifecycleOwner, ViewModelStoreOwner, SavedStateRegistryOwner, HasDefaultViewModelProviderFactory
生命周期拥有者的代理,
Functions
Link copied to clipboard
添加事件监听
Link copied to clipboard
fun <VM : ViewModel> ViewModelStoreOwner.createVM(modelClass: KClass<VM>, key: String?, extras: CreationExtras): VM
用于构造简单的ViewModel的工厂
Link copied to clipboard
包装获取泛型类型
Link copied to clipboard
用于构造具有空构造函数的ViewModel,如果需要更加强大的构造方式可以使用其他第三方库,比如koin
inline fun <VM : ViewModel> viewModel(noinline block: (SavedStateHandle) -> VM, key: String? = null): VM
用于构造有且只有SavedStateHandle作为参数的构造函数的ViewModel