Travis Griggs
07/17/2023, 11:47 PMaction = { cameraState.animate(CameraUpdateFactory.newLatLngBounds(sortedRegions.map { region -> region.coordinateBounds }
.reduce { accum, box -> accum.union(box) }, 20))
},
But the compiler complains about that `animate`:
Suspend function 'animate' should be called only from a coroutine or another suspend functionSo I get it. I need to fork/coroutine/whatever this block to not happen here, but in another execution context somehow. What is the idomatic way to do it? Is it a LaunchedEffect? Is there a decent primer on these "alternate/parallel execution contexts" for Compose that any can recommend?
Travis Griggs
07/17/2023, 11:49 PMStylianos Gakis
07/17/2023, 11:53 PMrememberCoroutineScope
then that sounds about right.
This action needs to know in which scope it will run in so that it knows when it no longer is relevant and should be cancelled, and this scope should accomplish that properly.
Btw curious, this cameraState, where does it come from?Travis Griggs
07/17/2023, 11:55 PMTravis Griggs
07/17/2023, 11:56 PMcom.google.maps.android:maps-compose:2.11.4