How to call Kotlin coroutine in composable function callbacks?
Create a coroutines scope, tied to the lifecycle of your composable, and use that scope to call your suspending function suspend fun getLocation(): Location? { /* … */ } @Composable fun F() { // Returns a scope that’s cancelled when F is removed from composition val coroutineScope = rememberCoroutineScope() val (location, setLocation) = remember { … Read more