Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set an active Marker with Google Maps on Flutter

I have a GoogleMap in my Flutter app. When the page loads it calls on API and gets a list of geolocations which I use to create a list of markers.

My GoogleMap uses this list of markers and they display nicely, however, I would like one of them to be active. I can't see anything in the API documentation that says this is possible. How can I achieve this?

like image 655
DrLazer Avatar asked Nov 13 '19 17:11

DrLazer


1 Answers

Use GoogleMapController to set the marker active, allMarkers here is a list of markers which might be coming from the database and the first one (index 0) will be active after execution of:

_googleMapController.showMarkerInfoWindow(allMarkers[0].markerId);

Documentation

like image 135
Seahlolo Makofane Avatar answered Sep 30 '22 14:09

Seahlolo Makofane