Is there any sort of equivalent mechanism to `@Dis...
# compose
Is there any sort of equivalent mechanism to
that I can apply to my own functions to not allow them to be called from inside composable functions? Or if not, any ideas on how to improve the developer experience regarding this: I have a function that looks like this:
Copy code
inline val Int.dp: Int
    get() = (this * Resources.getSystem().displayMetrics.density).toInt()
That is used from normal non-composable functions, but is simply annoying as it always comes as a code completion suggestion when I’m inside composable functions, but in there I always want the
import instead.
You could make a scope object
that provides that extension, but you'd need to use
with(X) { int.dp }
Kind of like
in Compose
Yeah, we're using the view version of .dp in quite a lot of places, I wouldn't want to change how it looks like on the call site optimally. I recently read about this maybe it's what I was looking for actually