Mark
02/09/2020, 4:39 AMContext
in via constructor or just accessing it inline with the help of a top-level property like:
val appContext by lazy {
GlobalContext.get().koin.get<Context>()
}
Since an application Context
is not mocked (I think!), is there any advantage to passing it into a constructor?itnoles
02/09/2020, 5:49 AMMark
02/09/2020, 6:31 AMGlobalContext
instead of to each constructor?il_agent
02/10/2020, 12:20 PMMark
02/10/2020, 12:26 PMMark
02/10/2020, 12:28 PMval someValue get() = // something cool
Furthermore, when accepting a Context arg, we cannot be sure if the Context is an application Context or something we should not be holding a reference to (Activity etc), so that complicates things a little.