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.
Lifecycle#
Most of these callbacks are optionals but can be overriden according to our needs.
onCreate#
void onCreate()This callback is called by the view after creation of the view.
onDispose#
void onDispose()This callback is called by the view before disposition of the view.
Model#
Model? getModel()void setModel(Model? model)Optionally we can assign a model for the view-model. Though optional but should be done inside onCreate.