'Android functions must be marked with the @Composable

I have a @Composable function that works perfectly with single element inside using the tutorial. However, by adding LocalInspectionMode.current or other elements, such as, column, it produces a strange error.

@Composable
fun MessageCard(name: String){
    if(LocalInspectionMode.current){
    Text("Hello $name!")
    } else {
        Text("Goodbye $name!")
    }
}

or

@Composable
fun MessageCard(msg: Message){
    Column {
        Text("Hello ${msg.author}!")
        Text("Hello ${msg.author}!")
    }
}

The error message:

Functions which invoke @Composable functions must be marked with the @Composable annotation

Obviously, the function does contain the @Composable annotation. Any help? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source