🌈 Create new beautiful Compose Gradients with our new wesite ->
Property

LocalResources

The Android Resources.

Source set: Android
public val LocalResources: ProvidableCompositionLocal<Resources> =
    compositionLocalWithComputedDefaultOf<Resources> {
        // Read LocalConfiguration here to invalidate callers of LocalResources when the
        // configuration changes. This is preferable to explicitly providing the resources object
        // because the resources object can still have the same instance, even though the
        // configuration changed, which would mean that callers would not get invalidated. To
        // resolve that we would need to use neverEqualPolicy to force an invalidation even though
        // the Resources didn't change, but then that would cause invalidations every time the
        // providing Composable is recomposed, regardless of whether a configuration change happened
        // or not.
        LocalConfiguration.currentValue
        LocalContext.currentValue.resources
    }

The Android Resources. This will be updated when LocalConfiguration changes, to ensure that calls to APIs such as Resources.getString return updated values.

Content updated: