Using "maps compose" I need to add a marker on the location that I click on. I have managed to add marker where I click but unfortunately the old marker disappears. I want to click on Sydney ( have a marker there ) then Melbourne ( add a new marker). Its not a cluster kind of requirement. I just want multiple markers added on the map. my code is
Box(Modifier.fillMaxSize()) {
GoogleMap(cameraPositionState = cameraPositionState,properties = mapProperties, uiSettings = mapUiSettings,
onMapClick = {viewModel.onMapClick(it)}
)
{
SydAU= viewModel.clickLoc.collectAsState().value
Marker(
state = MarkerState(position = SydAU),
title = "Marker in Sydney"
)
}
}
Thanks