In the Crane jetpack compose sample they update a MapView in an AndroidView using a remembered coroutine.
val coroutineScope = rememberCoroutineScope()
AndroidView({ map }) { mapView ->
coroutineScope.launch {
val googleMap = mapView.awaitMap()
// ...
}
}
As an exercise I removed the coroutine and instead use the old getMapAsync
AndroidView({ map }) { mapView ->
mapView.getMapAsync { googleMap ->
// ...
}
}
This appears to function correctly with the same performance, it also simplifies the code a little bit (no more need to remember a coroutine and arguably less mental gymnastics going between the old and new contexts).
Is there a hidden cost to doing this?