Closed kauaicreative closed 4 years ago
I think the answer is essentially yes and can be found here. https://medium.com/p/c14c3bdc2478/responses/show
@kauaicreative yes :) If you require it to be alive the entire app then you can do that. I have used it like that before. You have to ensure you don't dispose the viewmodel by either using ChangeNotifierProvider.value or the "not recommended one" override dispose in the viewmodel and never call super.dispose
Usually I want to keep the state of my ViewModelProvider for the life of the app. I recall in your filledstacks tutorals you would use Get_it,
locator.registerLazySingleton(() => MyViewModelProvider());
to solve this. Is that what you would recommend?