Can you use let for this? See <https://discuss.kot...
# compose-wear
s
Can you use let for this? See https://discuss.kotlinlang.org/t/let-vs-if-not-null/3542 mediaItem.mediaMetadata.artworkUri?.let { it -> ... }
y
like
Copy code
val appIcon: (@Composable () -> Unit)? = mediaItem.mediaMetadata.artworkUri?.let {
    { MediaArtwork(mediaItem) }
}
It's still awkward with the {} as an anonymous lambda. wonder if there should be something like Content {}
Copy code
fun Content(content: @Composable () -> Unit) = content

    val appIcon: (@Composable () -> Unit)? = mediaItem.mediaMetadata.artworkUri?.let {
        Content { MediaArtwork(mediaItem) }
    }
s
Personal preference - I think the let syntax is more concise than the original if/else statements.