LocalAnalytics
CompositionLocal for providing analytics logs to Compose UI components.
This allows analytics logs to be injected into the Compose tree and accessed by child composables without explicit parameter passing.
Usage
Providing Logs
CompositionLocalProvider(LocalAnalytics provides AnalyticsLogger.logs) {
AnalyticsScreen()
}Content copied to clipboard
Consuming Logs
@Composable
fun MyComponent() {
val analytics = LocalAnalytics.current
// Use analytics logs
}Content copied to clipboard
See also
Throws
if accessed without being provided in the Compose tree.