zsmb
02/26/2025, 3:05 PMBroadcastReceiver
that I need to inject at some point. As my Koin context is set up at the Compose entry point, it might not have been initialized when this BroadcastReceiver
is invoked.
So far I'm doing this, but wondering if it could be cleaner:
val logger = KoinPlatformTools.defaultContext().getOrNull()?.getOrNull<Logger>()
arnaud.giuliani
02/27/2025, 8:04 AMzsmb
02/27/2025, 8:09 AMarnaud.giuliani
02/27/2025, 10:29 AMKoinPlatform.getKoin().get<BroadcastReceiver>()
or or your snippet KoinPlatform.getKoin().getOrNull<Logger>()
zsmb
02/27/2025, 11:08 AMby inject
come from, which dependency? It seems like I might not have that. The one I have included so far is koin-compose-viewmodel-navigation
.arnaud.giuliani
02/27/2025, 4:12 PMby inject()
is available bye default in Android classes, or if you use KoinComponent
interfacearnaud.giuliani
02/27/2025, 4:12 PMKoinPlatform
API