loloof64
03/21/2023, 9:11 PMloloof64
03/21/2023, 9:12 PM@Composable
, I've createad a function startClockIfAppropriated
, but it seems that the coroutine I'm trying to launch inside it never start.loloof64
03/21/2023, 9:15 PMloloof64
03/21/2023, 9:16 PMloloof64
03/21/2023, 9:18 PMstreetsofboston
03/21/2023, 9:36 PMstartClockIfAppropriated
)?loloof64
03/21/2023, 9:49 PMstartNewGame()
function, I'm calling startClockIfAppropriated()
.
And I'm calling this function startNewGame()
when the user clicks on a button.
What happens here is that I'm passing a callback function to the `Screen.EditPosition`page of the function navigation.push()
so that it will be executed when we're back in the game screen if the user validated the new (chess) position they edited in this EditPosition
screen.streetsofboston
03/21/2023, 9:55 PM@Compose
function.
I can imagine that the rememberCoroutineScope
returns a CoroutineScope that may be cancelled or in a state that it can't launch coroutines.
Try moving all your functions outside of your (top) @Compose
function, make them global, and instead add parameters for those variable that you implicitly captured.loloof64
03/21/2023, 10:57 PM@Compose
functionloloof64
03/21/2023, 11:14 PMViewModel
because it belongs to Android.streetsofboston
03/21/2023, 11:16 PMloloof64
03/21/2023, 11:17 PMloloof64
03/21/2023, 11:38 PMstreetsofboston
03/21/2023, 11:43 PMloloof64
03/22/2023, 1:13 PM@Composable
, using two state holders instead. GamePageLogicState and GamePageClockState .loloof64
03/22/2023, 1:16 PMloloof64
03/22/2023, 2:04 PMloloof64
03/22/2023, 8:01 PMloloof64
03/22/2023, 8:02 PM