layers: [
MapShapeLayer(
source: _markedSource,
initialMarkersCount: 1,
selectedIndex: selectedIndex,
onSelectionChanged: (int index) {
setState(() {
selectedIndex = index;
});
},
markerBuilder: (BuildContext context, int index) {
return MapMarker(
latitude: _markedData[index].latitude,
longitude: _markedData[index].longitude,
iconColor: Colors.red);
}),
],
```
Hi Kotrotko,
Greetings from Syncfusion.
You can show marker on the selected shape by adding markers using the MapShapeLayerController.insertMarker option and remove all the markers using the MapShapeLayerController.clearMarkers option when deselecting the shape in the onSelectionChanged callback as shown in the below code snippet.
Please refer the below link for dynamically adding, removing, updating and clearing markers.
Link: https://help.syncfusion.com/flutter/maps/markers#adding-markers-dynamically
Code snippet:
class MapsMarkerSelection extends StatefulWidget { |
If you have any other specific requirement, kindly provide brief details about it.
Regards,
Lakshmi R.