Expect Actual Composable Capability

Expose a device capability to shared Compose code as a @Composable expect function, with a full implementation on the platform that has it and a stub that returns the neutral value on the platform that does not. Covers the three shapes these take — a measurement, an effect with an undo, and a subscription read as state — and why a stub must still be correct. Use when shared UI needs a window measurement, a keep-awake flag or a windowing-mode state, when one platform stops the app the first time a screen paints, or when a shared screen behaves as if a capability is off on a platform that has it.

maxrave-dev 9bf5b45 8.2 KB Updated

File contents

maxrave-dev/kotlin-footguns/tree/main/skills/expect-actual-composable-capability commit 9bf5b45748

Frequently asked questions

npx skillmds@latest add maxrave-dev/expect-actual-composable-capability