值参数/jetpackcompose 需要类型注释

问题描述 投票:0回答:1

我试图在 android studio 中创建一个可组合函数,它有一个可组合函数作为参数,但不返回任何内容。我正在按照 udemy 课程的步骤进行操作。这是图片enter image description here

尝试创建一个可组合函数,该函数接受可组合参数,但不返回任何内容

android-studio annotations android-jetpack-compose
1个回答
0
投票

只需在

@Composable
和括号之间添加一个空格即可:

// this is a variable of functional type "() -> Unit" with @Composable annotation
val content: @Composable () -> Unit,

// this is a call to constructor of @Composable annotation class and
// some invalid characters after it: "-> Unit"
val content: @Composable()-> Unit,
© www.soinside.com 2019 - 2024. All rights reserved.