Hi, can I store a composable function as a variabl...
# compose
e
a
val some: @Composable () -> Unit = ::someFunction
m
FWIW, that does not seem to help, at least with Arctic Fox Canary 12. It changes the error message to
TYPE_MISMATCH(a = [@androidx.compose.runtime.Composable] Function0<Unit>, b = KFunction0<Unit>)
. That message better matches my feature request, which was marked as a duplicate of this feature request.
a
IDE may show errors but it should compile and work just fine.
a
Composable function reference is not yet supported so you have to write
val functionVariable: @Composable () -> Unit = { myFunction() }
.
👍 1
a
Correct, my mistake. Use Lambdas for now.
e
Nice one. That works for now. Hope composable function reference will be available one day. Thanks! 🙏