如何使用Flutter Web点击谷歌地图中的地图来添加多个标记?所有教程都使用了google_maps_flutter,而不是google_maps_flutter_web。
试试这个,
//list of markers
final Set<Marker> markers = new Set();
markers.add(Marker( //add first marker
markerId: MarkerId(showLocation.toString()),
position: showLocation, //position of marker
infoWindow: InfoWindow( //popup info
title: 'My Custom Title ',
snippet: 'My Custom Subtitle',
),
icon: BitmapDescriptor.defaultMarker, //Icon for Marker
));
markers.add(Marker( //add second marker
markerId: MarkerId(showLocation.toString()),
position: LatLng(27.7099116, 85.3132343), //position of marker
infoWindow: InfoWindow( //popup info
title: 'My Custom Title ',
snippet: 'My Custom Subtitle',
),
icon: BitmapDescriptor.defaultMarker, //Icon for Marker
));
GoogleMap( //Map widget from google_maps_flutter package
markers: markers, //markers to show on map
)