title: How to pass conditional parameter in Jetpack Compose?
body: <p>I want to hide the <strong>navigationIcon</strong> but when I pass <code>null</code> or <code>Unit</code> the icon space remains visible, as can be seen in the image below.</p>
  <p><a href="https://i.stack.imgur.com/kbH5s.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kbH5s.png" alt="Menu preview" /></a></p>
  <pre class="lang-kotlin prettyprint-override"><code>@Composable
  fun DefaultScaffold(
      title: String? = null,
      icon: ImageVector? = null,
      content: @Composable() () -&gt; Unit
  ) {
      Scaffold(
          topBar = {
              TopAppBar(
                  title = {
                      if (title != null) {
                          Text(text = &quot;My Title&quot;)
                      }
                  },
                  navigationIcon = {
                      if (icon != null) {
                          IconButton(
                              onClick = {}
                          ) {
                              Icon(imageVector = Icons.Filled.Close, contentDescription = null)
                          }
                      } else Unit
                  }
              )
          }
      ) {
          content()
      }
  }
  </code></pre>