Questions tagged [koin-scope]

Koin Scope is the Scope feature of Koin

Koin Scope is the Scope feature of Koin https://stackoverflow.com/tags/koin/info

32 questions
7
votes
1 answer

Koin share dependencies scoped to nested graph

I'm wondering how to properly scope dependencies with Koin library. Since Google recommends a single Activity architecture the AndroidX Navigation lib has become a key library to facilitate this by easily swapping Fragments. A typical modern Android…
5
votes
1 answer

Koin's lifecycleScope vs activity.scope. Are they the same?

I'm learning Koin's Scope from https://github.com/InsertKoinIO/koin/blob/master/koin-projects/docs/reference/koin-android/scope.md If I have a Koin module as below val myModule = module { scope { scoped { Presenter() } } …
Elye
  • 53,639
  • 54
  • 212
  • 474
4
votes
0 answers

Koin NoBeanDefFoundException

Long story short, I am facing strange app crashes with NoBeanDefFoundException, but it happens randomly. For some devices it works as expected and for others just crashes. I have a multi module project with lots of koin modules and it worked as…
Yamko
  • 535
  • 1
  • 3
  • 13
3
votes
1 answer

Why is Koin scoping feature not working properly?

So scoping with Koin DI seem to throw a weird exception when KoinApplication::checkModules() method is called within a unit test. Here is the full code: import org.koin.core.KoinApplication import org.koin.core.component.KoinComponent import…
2
votes
1 answer

scoped injection with koin 3

I am trying to upgrade my koin usage from 2.1.6 -> 3.0.2 and am having troubles with the scoped injections. I have MVPs where the Activity/Fragment is the view and i want to inject the view in the presenter. so i have module { …
siliconeagle
  • 7,379
  • 3
  • 29
  • 41
2
votes
1 answer

Koin Libraray Issue in Android Studio

Could not GET 'https://dl.bintray.com/ekito/koin/org/koin/koin-core/3.0.1/koin-core-3.0.1.pom'. Received status code 403 from server: Forbidden Disable Gradle 'offline mode' and sync project Adding this line show error maven(url =…
Anuj kumar
  • 71
  • 3
2
votes
2 answers

How to inject view model with scope using sharedview model koin android

need little bit clarity on one thing, right now working on a flow where I've two view model and one is dependent on other , to handle that thing I tried injecting both view models in my Base Activity the problem I faced, with this approach. Every…
Atif AbbAsi
  • 5,633
  • 7
  • 26
  • 47
2
votes
1 answer

No Koin Context configured. Please use startKoin or koinApplication DSL

koin works fine with most of my devices of same model but it cause crash in single device with the IllegalStateException, i have give android context as applicationContext but still it is cause crash. Before Updating to Latest Version it was…
Khalid Saeed
  • 131
  • 2
  • 8
1
vote
0 answers

How to create scope for parent fragment to use it in children

I have a class TestClass and I want to share its instance between child fragment with using koin scope of parent fragment. Is it possible to do? Thanks. I try: class TestClass { fun close() { .... } } class ParentFragment(): Fragment { } val…
Sabrak
  • 21
  • 3
1
vote
0 answers

Custom scope with koin and kotlin

I must use Koin to construct a custom scope using "Android Service" in my Android app module. I read other blogs and the Koin documentation; a few of them are below. Understanding Android Scopes with Koin Android Sample project Koin Scope…
CLIFFORD P Y
  • 16,974
  • 6
  • 30
  • 45
1
vote
0 answers

NoBeanDefFoundException but scope is already defined

I'm trying to solve this issue: I'm receiving a crash whenever i try to click on a push notification in certain fragment, that would redirect me to another fragment in the app. I defined my module like this: scope(named()) { …
1
vote
1 answer

How to scope a Usecase to a Feature / Activity in Koin

I'm maintaining a large app (mostly) using a "one feature one activity"-architecture. Now i'd like to scope a usecase, so it lives as long as the activity, something like this: // koin module scope { viewModel {…
m.reiter
  • 1,796
  • 2
  • 11
  • 31
1
vote
0 answers

Inject scoped class to viewmodel of a fragment

I have this particular test case that I don't know how to solve with Koin. I have a FooClass tied to the MainActivity lifecycle, and I have other fragments that also need to use FooClass. Those fragments need the FooClass to be inject in the…
appersiano
  • 2,670
  • 22
  • 42
1
vote
0 answers

Koin FragmentFactory fails to handle activity re-creation

I am using the latest Koin version 3.1.2. I have a basic Fragment that accepts a String parameter to it's constructor. My Koin setup is as follows: Activity: override val scope: Scope by activityScope() private val fragment by inject { …
TareK Khoury
  • 12,721
  • 16
  • 55
  • 78
1
vote
0 answers

Is there a way to copy or clone Koin scope as new scope instance?

Using Koin library I'm trying to achive this behaviour: val scopeA = getScope(ID) val scopeB = scopeA.clone() Short speaking, clone() should copy all instances from one scope to another. So in this case I can modify scopeB without modifying the…
1
2 3