an_viewmodel 3.6.0
an_viewmodel: ^3.6.0 copied to clipboard
A package for managing ViewModel that depends on an_lifecycle. Similar to Androidx ViewModel.
3.6.0 #
- AsyncData migrated to the an_async_data package.
3.5.1 #
- Update readme.
3.5.0 #
- Added ViewModel.useHostLifecycle
3.4.1 #
- Code standardization
3.4.0 #
- Optimize the search efficiency of ViewModelProvider
3.3.0 #
- 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.1 #
- Optimize the cleanup timing of _MergingValueNotifier.
3.2.0 #
- Upgrading Dependencies.
3.1.0 #
- RefViewModelProvider now supports handling viewModelStore removal.
3.0.3 #
- Fix the bug in the ViewModel extension viewModels.
3.0.2 #
- Fix the bug when viewModelProviderProducer is null.
3.0.1 #
- Adjust example
3.0.0 #
- 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.4 #
- Fix the bug of clearing the ViewModel when removing from ViewModelStore.
2.1.3 #
- Print logs for ViewModel creation and cleanup in non-release mode.
2.1.2 #
- Upgrading Dependencies.
2.1.1 #
- Add more proactive notifications to valueNotifierStreamXXX when notifyWhenEquals=true.
2.1.0 #
- BuildContext.withLifecycleAndViewModelEffect allows executing lifecycle-related functions based on the current context and ViewModel.
- Optimize the usage of ViewModelProviderProducer.
2.0.0 #
- 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.
1.0.0 #
- Migrate from an_lifecycle_viewmodel.