an_viewmodel
A package for managing ViewModel that depends on anlifecycle. Similar to Androidx ViewModel.
3.8.0
aymtools/an_viewmodel
What this package is like to depend on
Last release 15 days ago
09 Aug 2026
Release timing varies
gaps range from 1 weeks to 4 months
Nearly every release is documented
notes for 22 of 22 stable releases
Nothing withdrawn
no release was ever pulled
2 years old
24 releases · first in 2024
8 releases in the last 12 months
see the full history below
Release timeline
24 releases · Nov 2024 to Aug 2026
2025
2026
Releases
latest 24-
3.8.009 Aug 2026Release notes
Open source →ViewModel.useHostLifecyclenow supports customonClearedstate handling.- Deprecated: Marked the
onCreatelifecycle method as deprecated due to naming ambiguity ( users frequently confused whether the ViewModel was actively creating or already created). It will be completely removed in a future major release. - Migration Guide: Please migrate your initialization logic from
onCreateto the newly introducedonCreatedmethod.
-
3.7.004 Apr 2026 -
3.6.028 Dec 2025 -
3.6.0-pre.117 Dec 2025 pre-releaseNothing published for this version
-
3.5.101 Nov 2025 -
3.5.027 Sep 2025 -
3.4.111 Sep 2025 -
3.4.007 Sep 2025 -
3.3.019 Aug 2025Release notes
Open source →- Added support for specifying the type during creation to enable runtime ViewModel instantiation.
- ViewModelProvider.getOrCreate is deprecated, please use getOrCreateViewModel instead.
Breaking Changes
- All ViewModel functions in ViewModelStore now have an optional vmType parameter.
-
3.2.103 Aug 2025 -
3.2.006 Jul 2025 -
3.1.003 Jun 2025 -
3.0.301 Jun 2025 -
3.0.220 May 2025 -
3.0.115 May 2025 -
3.0.015 May 2025Release notes
Open source →- Add onCreate method to ViewModel, called after the ViewModel is created.
- Add a viewModels extension method in ViewModel to retrieve ViewModels stored at the same level or higher levels.
- Add to remember the ViewModelProviderProducer when creating the ViewModel, ensuring the same behavior for subsequent automatic creations.
- ViewModel.doNotAssertProviderProducer is used for compatibility when upgrading from v2 to v3, to prevent asserting and checking the validity of the ProviderProducer.
Breaking Changes
- Change ViewModelProvider.get to getOrCreate
-
2.1.401 Apr 2025Release notes
Open source →- Fix the bug of clearing the ViewModel when removing from ViewModelStore.
-
2.1.306 Mar 2025 -
2.1.206 Mar 2025 -
2.1.126 Feb 2025Release notes
Open source →- Add more proactive notifications to valueNotifierStreamXXX when notifyWhenEquals=true.
-
2.1.023 Feb 2025Release notes
Open source →- BuildContext.withLifecycleAndViewModelEffect allows executing lifecycle-related functions based on the current context and ViewModel.
- Optimize the usage of ViewModelProviderProducer.
-
2.0.008 Feb 2025Release notes
Open source →- Added makeCloseable to provide cancelable based on viewmodel lifecycle.
- ViewModel adds extensions: valueNotifier, valueNotifierAsync, valueNotifierStream, valueNotifierAsyncStream, valueNotifierFuture, valueNotifierAsyncFuture, valueNotifierStreamController, valueNotifierAsyncStreamController, valueNotifierTransform, valueNotifierMerge to facilitate the rapid construction of ValueNotifiers.
Breaking Changes
- viewModels(factory,factory2) : Parameters factory and factory2 are no longer automatically added to ViewModelProvider to prevent memory leaks.
- RefViewModelProvider is no longer a subclass of ViewModel.
- viewModelsByRef(factory2) : The lifecycle parameter of factory2 is changed to AppLifecycle.
- ViewModelStore : The key in ViewModelStore has been adjusted to its type.
-
2.0.0-dev.118 Jan 2025 pre-releaseNothing published for this version
-
1.0.011 Nov 2024