2.1.x Saved state handle suggestions
See original GitHub issueHi,
I’m implementing the new saved state handle in our MVI library sample and found the Koin API for handing saved state view models slightly too implicit.
Passing in a bundle
like
private val viewModel by viewModel<TodoViewModel> { parametersOf(Bundle()) }
feels slightly too “magic” (pass in a bundle to make it work). In my case the view models would handle their own initial state, meaning I have to pass in an empty bundle every time. Looking at androidx.lifecycle.SavedStateHandle#createHandle
null default state bundles are allowed though.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Saved State module for ViewModel - Android Developers
As mentioned in Saving UI States, ViewModel objects can handle configuration changes, so you don't need to worry about state in rotations or...
Read more >Koin sharedViewModel with SavedStateHandle - Stack Overflow
What if I want to have the model both shared and keep its state with SavedStateHandle? I cannot figure out if this is...
Read more >Saving UI state with ViewModel SavedState and Dagger
The way it works is by passing a SavedStateHandle to the ViewModel's constructor, which you can then use to restore/save the state.
Read more >Source Code for SavedStateHandle.java - AndroidX Tech
Set; /** * A handle to saved state passed down to {@link androidx.lifecycle. ... public final class SavedStateHandle { final Map<String, Object> mRegular; ......
Read more >Delete Specific Application Saved States from Mac OS X ...
This tip will show you how to selectively remove saved app states for chosen applications. You can think of Resumes saved state files...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
just added the new API in
alpha-11
… soon the beta 👍Thanks!