bhatnagarm
04/29/2020, 8:53 PMstreetsofboston
04/29/2020, 9:04 PMstreetsofboston
04/29/2020, 9:05 PMobject
, but a plain class
instead that is only instantiated once (a Dagger @Singleton
)bhatnagarm
04/29/2020, 9:24 PMstreetsofboston
04/29/2020, 9:36 PMbhatnagarm
04/29/2020, 9:44 PMtschuchort
04/29/2020, 9:44 PMbhatnagarm
04/29/2020, 9:44 PMbhatnagarm
04/29/2020, 9:45 PMbhatnagarm
04/29/2020, 9:45 PMbhatnagarm
04/29/2020, 9:47 PMaipok
04/29/2020, 10:37 PMsingle instance
with Koin for components that are required to be accesible in whole app.
If lifecycle is different it is better to wrap it to some scope.
Previously instances, that were needed across the app, were holded by Application class.
Nowdays DI could handle single
instance of the class and inject it to the right place. Basic different between object
and single
in DI is that single
is not holded as static instance. The DI usually has static access, but all the instances that defined by DI are holded inside the DI as regular fields.
In Android world I don’t have anything against object
if you don’t plan to test the instance or reload it. object
will leave same time as you application class, so whats the difference 😄tschuchort
04/30/2020, 4:46 PM