title: Programmatically Select Marker to Navigate To Location Google_Maps_Flutter
body: <p>I am trying to develop a user experience where the user is provided a list of venues to travel to, and upon selecting one of those locations, I want it to</p>
  <ol>
  <li>Add a marker to the map</li>
  <li>Show an info window</li>
  <li>Provide the option to navigate to the
  location.</li>
  </ol>
  <p>I was able to use the information <a href="https://github.com/flutter/plugins/pull/2181" rel="noreferrer">from this PR</a> (that has no official documentation it seems) to go from this:</p>
  <p><a href="https://i.stack.imgur.com/BH2S0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BH2S0.png" alt="Before use of PR" /></a></p>
  <p>To this:</p>
  <p><a href="https://i.stack.imgur.com/uUiBv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uUiBv.png" alt="Functionality after using the showMarkerInfo function" /></a></p>
  <p>However, showing the marker info still does not make the given marker &quot;active&quot;. When I select the marker, the functionality of the plugin actually displays options for navigating to the given location on the bottom right, like this:</p>
  <p><a href="https://i.stack.imgur.com/fVgZZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fVgZZ.png" alt="Functionality of the Google_Maps_Flutter plugin when the marker is actually selected." /></a></p>
  <p>What I would like is for the selection of the venue at the bottom of the list to automatically display all three criteria in the third image with one press. That is, once again:</p>
  <ol>
  <li>The marker of the location</li>
  <li>The info window</li>
  <li>The option to navigate to that location.</li>
  </ol>
  <p>Right now, a user has to click the entry from the list at the bottom, and then rather un-intuitively <em>click the marker on the map</em> in order for the navigation options to appear.</p>
  <p><strong>How would I go about programatically launching the &quot;on-tap&quot; event that happens when the user &quot;taps&quot; the marker when selecting an item from the list?</strong></p>
  <p>Here is my current code for changing the viewport, adding a marker, and showing the info window:</p>
  <pre><code>Future&lt;void&gt; goSomewhere(id, name, distance, address, lat, lng) async {
  final GoogleMapController controller = await _controller.future;
  controller.animateCamera(CameraUpdate.newCameraPosition(
      CameraPosition(target: LatLng(lat, lng), zoom: 14.0)));
  setState(() {
    _markers.add(Marker(
      markerId: MarkerId(id),
      position: LatLng(lat, lng),
      infoWindow: InfoWindow(
        title: name,
        snippet: address,
      ),
      onTap: () {
        //_pageController.jumpToPage(i);
      },
      icon: BitmapDescriptor.defaultMarker,
    ));
    print(MarkerId(id));
    controller.showMarkerInfoWindow(MarkerId(id));
  });
  </code></pre>
  <p>}</p>
  <p>Right now, my solution does add the marker and show the info window, but comes up short giving the user options for navigating to the location <em>unless</em> the user clicks the marker. In its current state, I've built something that makes for a very sub-optimal user experience.</p>
  <p>I've tried alternative solutions like <a href="https://gist.github.com/sh0umik/05ab4cad0d4604056e715551d67cb063" rel="noreferrer">highlighting the marker</a>, but it does not quite have the functionality I'm looking for. I do not understand what event occurs within the plugin that &quot;selects&quot; the marker on-tap, and all attempts I've found that &quot;programmatically&quot; select the marker do some version of highlighting it. Simply some direction as to where to look to find out what event is being launched when the marker is clicked would be helpful.</p>