-
public final class ViewModelKtxKt
-
-
Field Summary
Fields Modifier and Type Field Description private final static <ERROR CLASS>vMStores
-
Method Summary
Modifier and Type Method Description final <ERROR CLASS>getVMStores()存储作用域名称与对应的 VMStore 实例的映射。 final static <VM extends ViewModel> Lazy<VM>shareViewModels(LifecycleOwner $self, String scopeName, ViewModelProvider.Factory factory)提供一个延迟初始化的 ViewModel 实例,该实例可以在指定的作用域内被共享。 -
-
Method Detail
-
getVMStores
final <ERROR CLASS> getVMStores()
存储作用域名称与对应的 VMStore 实例的映射。
-
shareViewModels
final static <VM extends ViewModel> Lazy<VM> shareViewModels(LifecycleOwner $self, String scopeName, ViewModelProvider.Factory factory)
提供一个延迟初始化的 ViewModel 实例,该实例可以在指定的作用域内被共享。
- Parameters:
scopeName- 作用域名称,用于区分不同的 ViewModel 存储。factory- 可选的 ViewModelProvider 工厂,用于创建 ViewModel 实例。
-
-
-
-