State Shared View Model
See original GitHub issueIs there a way to have a state shared view model? I tried to use by stateViewModel()
is the activity and by sharedViewModel()
in the fragments but I keep getting this crash:
org.koin.core.error.NoParameterFoundException: Can't get parameter value #0 from org.koin.core.parameter.DefinitionParameters@f41855c
org.koin.core.parameter.DefinitionParameters.elementAt(DefinitionParameters.kt:32)
org.koin.core.parameter.DefinitionParameters.component1(DefinitionParameters.kt:34)
[...].di.ViewModelsModuleKt$viewModels$1$3.invoke(Unknown Source:10)
[...].di.ViewModelsModuleKt$viewModels$1$3.invoke(Unknown Source:4)
org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:50)
org.koin.core.instance.FactoryInstanceFactory.get(FactoryInstanceFactory.kt:36)
org.koin.core.registry.InstanceRegistry.resolveInstance$koin_core(InstanceRegistry.kt:87)
org.koin.core.scope.Scope.resolveInstance(Scope.kt:214)
org.koin.core.scope.Scope.get(Scope.kt:181)
org.koin.androidx.viewmodel.ViewModelFactoryKt$defaultViewModelFactory$1.create(ViewModelFactory.kt:50)
androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:187)
androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:150)
org.koin.androidx.viewmodel.ViewModelResolutionKt.get(ViewModelResolution.kt:21)
org.koin.androidx.viewmodel.ViewModelResolutionKt.resolveInstance(ViewModelResolution.kt:10)
org.koin.androidx.viewmodel.scope.ScopeExtKt.getViewModel(ScopeExt.kt:70)
org.koin.androidx.viewmodel.scope.ScopeExtKt.getViewModel(ScopeExt.kt:56)
org.koin.androidx.viewmodel.koin.KoinExtKt.getViewModel(KoinExt.kt:34)
org.koin.androidx.viewmodel.ext.android.FragmentExtKt.getSharedViewModel(FragmentExt.kt:57)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Shared ViewModel Across Fragments - Android Developers
You will learn how to use a shared ViewModel to share data between the fragments of the same activity and new concepts like...
Read more >Shared ViewModel in Android - GeeksforGeeks
In android, we can use ViewModel to share data between various fragments or activities by sharing the same ViewModel among all the fragments ......
Read more >Shared ViewModel in Android: Shared between Fragments
Using SharedViewModel, we can communicate between fragments. If we consider two fragments, both the fragments can access the ViewModel through ...
Read more >Advanced ViewModels (part III): Sharing data between ...
TL;DR: We can pass parameters to our ViewModel, use it as a data holder, also to share data between Fragments, and to persist...
Read more >Sharing data between fragments using new architecture ...
Logic and data between two Fragments now lay out in ViewModel. · Two Fragment gets data/state from ViewModel, so they do not need...
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
it’s back in 3.0.1
great