ViewModel
ViewModel store and manage view related data in a lifecycle conscious way.
info
ViewModel is not aware of existence of the view according to dependency rule of clean architecture.
#
LifecycleMost of these callbacks are optionals but can be overriden according to our needs.
#
onCreatevoid onCreate()
This callback is called by the view after creation of the view.
#
onDisposevoid onDispose()
This callback is called by the view before disposition of the view.
#
ModelModel? getModel()void setModel(Model? model)
Optionally we can assign a model for the view-model. Though optional but should be done inside onCreate.