stacked
stacked copied to clipboard
[feature]: Ability to override the onViewModelReady on the ViewModel
Is your feature request related to a problem? Please describe.
I have been using stacked for a while now and I have found myself repeating these lines below in the view
@override
void onViewModelReady(XyzViewModel viewModel) {
viewModel.init();
}
Basically just using it to call a method (in this case init()) in the view model that does some initialisation stuff or calling some other function.
Describe the solution you would like
It would be great to be able to override the onViewModelReady in the viewModel itself that way we can avoid creating another function in the viewModel (in the above example init() ) just to call other functions in the viewModel. This would also make it a bit more expressive and readable and probably make testing the view model in isolation from the view better.
I like this request. we'll consider it during today's work selection.
Thanks for filing it @Henriquedn
This was not added since we can simply call a function from onViewModelReady.