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()
}

Consuming Logs

@Composable
fun MyComponent() {
val analytics = LocalAnalytics.current
// Use analytics logs
}

See also

Throws

if accessed without being provided in the Compose tree.