is there a way to check at runtime if compose is ...
# compose
c
is there a way to check at runtime if compose is running in preview or in device/emulator?
TLDR: The very concept of such a function makes me very nervous.  It makes me think your widget is not sufficiently isolated / is not a function of its parameters.  Why do you want to know if you're in a preview?
👍 1
g
@jim Maybe I would like to mock view model if you can't instantiate it in a preview
Ok, I've read you answer about this in that post
👍 1
j
For anyone who had the same question but didn't read the full thread: The general answer to "I would like to mock view model if you can't instantiate it in a preview"... your widget should be abstracted in such a way that it is not depending on a data model that is only available in your Android app, and instead should take in an interface that can be instantiated within your preview function and passed to the Composable.