Package com.drake.serialize.model

Types

StateViewModel
Link copied to clipboard
open class StateViewModel(stateHandle: SavedStateHandle) : ViewModel
继承这个类可以快速创建具备SaveInstance功能的ViewModel

Functions

stateHandle
Link copied to clipboard
inline fun <V> StateViewModel?.stateHandle(defValue: V? = null, name: String? = null): ReadWriteProperty<StateViewModel, V>
自动根据生命周期使用FragmentActivity.onSaveInstanceState
stateModels
Link copied to clipboard
inline fun <V : StateViewModel> Fragment?.stateModels(): Lazy<V>
inline fun <V : StateViewModel> FragmentActivity?.stateModels(): Lazy<V>
返回当前组件指定的SavedViewModel 要求数据类型为StateViewModel的子集