Skip to content

[google_flutter_map] Small bug in one of the examples  #76492

@vishnuagbly

Description

@vishnuagbly

I found a small bug in the example in google maps flutter.

there is a function written as:-

void _onMarkerTapped(MarkerId markerId) {
    final Marker? tappedMarker = markers[markerId];
    if (tappedMarker != null) {
      setState(() {
        if (markers.containsKey(markerId)) {
          final Marker resetOld = markers[markerId]!
              .copyWith(iconParam: BitmapDescriptor.defaultMarker);
          markers[markerId] = resetOld;
        }
        selectedMarker = markerId;
        final Marker newMarker = tappedMarker.copyWith(
          iconParam: BitmapDescriptor.defaultMarkerWithHue(
            BitmapDescriptor.hueGreen,
          ),
        );
        markers[markerId] = newMarker;
      });
    }
  }

here instead of resetting markers[markerId] we should reset markers[selectedMarker].
I have opened a pull request for it, can someone guide me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    d: examplesSample code and demosp: mapsGoogle Maps pluginpackageflutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionwaiting for PR to land (fixed)A fix is in flight

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions