Is there any way to exclude a composable from comp...
# compose
b
Is there any way to exclude a composable from compose preview? I use
Copy code
context.packageManager.getApplicationIcon(context.packageName)
to load my app icon as a drawable and display it with compose. But because of this, most of my previews fail to render because previews doesn't support the use of Android packagemanager.
t
You can just wrap this around a
if (isPreview)
and display some dummy icon when it’s a preview. That’s what I do for my launcher application for example.
b
@Tgo1014 Where does the
isPreview
come from?
t
isPreview
==
LocalInspectionMode.current == true
1