Is early returning in @Composable code smell? I'd ...
# compose-android
f
Is early returning in @Composable code smell? I'd like to do something like this inside a Composable function.
Copy code
val apkIcon = file.getApkIcon(LocalContext.current)
            if (apkIcon == null) {
                return Icon(Icons.Default.Android, file.nameWithoutExtension, modifier)
            }
            return Image(apkIcon.asImageBitmap(), file.nameWithoutExtension, modifier)
p
Is not IMO
3
e
https://issuetracker.google.com/issues/264467571 there have been compiler issues with early returns before. if you run into anything, file tickets bugs with repro
👀 2
1