This message was deleted.
# compose
s
This message was deleted.
0️⃣ 1
o
For classes it would be
null
, see this example with JvmOverloads here: https://medium.com/@debuggingisfun/kotlin-default-parameter-values-5b0046664c0c
u
Wdym? The specified default would be used
o
Yeap, Composables are "just" Kotlin functions, so they have same rules. You can verify it in Android Studio. Tools -> Kotlin -> Show Kotlin Bytecode. For example for these Composable and class:
Copy code
@Composable
fun Foo() {
    Bar()
}

@Composable
fun Bar(a: MyClass = MyClass(42)) {
  // Empty
}

class MyClass(
    val value: Int,
)
Decompiled bytecode looks like this:
Copy code
@Composable
public static final void Foo(@Nullable Composer $composer, int $changed) {
   ...
   Bar((MyClass)null, $composer, 0, 1);
   ...
}

@Composable
public static final void Bar(@Nullable MyClass a, @Nullable Composer $composer, int $changed, int var3) {
   ...
   if ((var3 & 1) != 0) {
       a = new MyClass(42);
       ...
   }
   ...
}
Huh, strange, I see that button even on Quail 2 (2026.1.2 Canary 2) Sure, here you are, I just replaced
Log.d
with
println
, as I am using CMP project
❤️ 1
Check if you have this plugin enabled? It should ne on by default, but worth checking 🤷