Flutter google map web marker on click

444 views Asked by At

I am using this library in my app to load the Google map on the web using this answer as a reference, I am able to add the marker on it but wondering how I can do the marker on tap action

Adding marker:

final _icon = jsMap.Icon()
      ..scaledSize = jsMap.Size(60, 60)
      ..url = 'https://www.freeiconspng.com/thumbs/pin-png/pin-png-9.png';

final marker = jsMap.Marker(
      jsMap.MarkerOptions()
          ..position = latLng1
          ..map = map
          ..title = 'Test Title1'
          ..icon = _icon
        );
1

There are 1 answers

0
Shailendra Madda On BEST ANSWER

I am able to do the on click action using the below code:

final infoWindow =
        jsMap.InfoWindow(jsMap.InfoWindowOptions()..content = 'This is the content inside the Info window');
    marker.onClick.listen((event) => infoWindow.open(map, marker));

It may help someone!