title: Adding markers dynamically to flutter google map
body: <p>I'm using Flutter to make a mobile application that uses a map. We decided to use Google map and the plugin for flutter we use is:</p>
  
  <blockquote>
    <p>google_maps_flutter: ^0.5.7</p>
  </blockquote>
  
  <p>I understand that adding markers to the map works like this:</p>
  
  <pre><code>Map&lt;MarkerId, Marker&gt; markers = &lt;MarkerId, Marker&gt;{};
  Marker _marker = new Marker(
    icon: BitmapDescriptor.defaultMarker,
    markerId: _markerId,
    position: LatLng(34.024441,-5.0310968),
    infoWindow: InfoWindow(title: "userMarker", snippet: '*'),
  );
  GoogleMap _map;
  
  @override
  void initState(
     markers[_markerId] = _marker;
     _map = new GoogleMap(
      /* other properties irrelevant to this prob */
      markers: Set&lt;Marker&gt;.of(_markers.values),
    );
  );
  </code></pre>
  
  <p>The above snippet does work, I get to see the marker on the map. But modifying the marker or trying to add another marker like in the snippet below does not work.</p>
  
  <pre><code>FloatingActionButton(
      onPressed: () {
        setState(() {
          _marker = new Marker(
              icon: BitmapDescriptor.defaultMarker,
              markerId: _markerId,
              position: LatLng(currentLocation.latitude, currentLocation.longitude),
              infoWindow: InfoWindow(title: "userMarker", snippet: '*'),
              onTap: () {
                debugPrint("Marker Tapped");
              },
            );
          markers[_markerId] = _marker; // What I do here is modify the only marker in the Map.
        });
        markers.forEach((id,marker) { // This is used to see if the marker properties did change, and they did.
          debugPrint("MarkerId: $id");
          debugPrint("Marker: [${marker.position.latitude},${marker.position.longitude}]");
        });
      });
  )
  </code></pre>
  
  <p>My intention here is using another plugin (geoLocator) to get location data of the user and change the only marker I have so it can track his movements. The debugPrint shows that the data is indeed changing, but I see no change in the map (the initial marker that I change uses a different location than my own when I test).</p>