assuming `Content1()` returns a `@Composable () -&...
# compose
l
assuming
Content1()
returns a
@Composable () -> Unit
it should work fine. i think there used to be a bug related to this type of thing but shouldn’t be any more. please file one if it doesn’t work
🧵 2
d
oh, right, I forgot to add curleys, will edit. Good to know, thanks!
I meant this:
Copy code
fun MyComposable(
  value: Boolean,
  slot1: @Composable () -> Unit = if (value) { Content1() } else { Content2() },
  slot2: @Composable (() -> Unit)? = if (value) { Content1() } else null,
)
l
the type system probably won’t like that since the curlies are ambiguous with the if / else blocks but the gist of what you are trying to do should be allowed, yes
d
oh, right! failed again )) But you understood what I meant, yeah. Will report then if something fails (I'm 90% sure it wont if you fixed this)