I've used compositionLocalOf
as follows:
val SoundSelectionProvider = compositionLocalOf<String> { error("No value provided") }
var sound = "Option 1"
Android Studio shows a hint:
CompositionLocal properties should be prefixed with Local
what does it mean?
CodePudding user response:
Just that as a matter of convention, the names of the providers should start with the word, "Local". So, just rename "SoundSelectionProvider" to "LocalSoundSelectionProvider" and the error will go away.
CodePudding user response:
Note: CompositionLocal objects or constants are usually prefixed with Local to allow better discoverability with auto-complete in the IDE.
https://developer.android.com/jetpack/compose/compositionlocal
It means as in description for discoverability your SoundSelectionProvider
is better to be named with a prefix with Local such as LocalSoundSelection