Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions packages/google_maps_flutter/lib/src/marker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,39 @@ class Marker {
}

@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (other.runtimeType != runtimeType) return false;
final Marker typedOther = other;
return markerId == typedOther.markerId;
}
bool operator ==(Object other) =>
identical(this, other) ||
other is Marker &&
runtimeType == other.runtimeType &&
markerId == other.markerId &&
alpha == other.alpha &&
anchor == other.anchor &&
consumeTapEvents == other.consumeTapEvents &&
draggable == other.draggable &&
flat == other.flat &&
icon == other.icon &&
infoWindow == other.infoWindow &&
position == other.position &&
rotation == other.rotation &&
visible == other.visible &&
zIndex == other.zIndex &&
onTap == other.onTap;

@override
int get hashCode => markerId.hashCode;
int get hashCode =>
Comment thread
KlausJokisuo marked this conversation as resolved.
Outdated
markerId.hashCode ^
alpha.hashCode ^
anchor.hashCode ^
consumeTapEvents.hashCode ^
draggable.hashCode ^
flat.hashCode ^
icon.hashCode ^
infoWindow.hashCode ^
position.hashCode ^
rotation.hashCode ^
visible.hashCode ^
zIndex.hashCode ^
onTap.hashCode;

@override
String toString() {
Expand Down
10 changes: 6 additions & 4 deletions packages/google_maps_flutter/lib/src/marker_updates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class _MarkerUpdates {
final Set<MarkerId> prevMarkerIds = previousMarkers.keys.toSet();
final Set<MarkerId> currentMarkerIds = currentMarkers.keys.toSet();

final Set<Marker> previousMarkersSet =
Set<Marker>.of(previousMarkers.values);
final Set<Marker> currentMarkersSet = Set<Marker>.of(currentMarkers.values);

Marker idToCurrentMarker(MarkerId id) {
return currentMarkers[id];
}
Expand All @@ -36,10 +40,8 @@ class _MarkerUpdates {
.map(idToCurrentMarker)
.toSet();

final Set<Marker> _markersToChange = currentMarkerIds
.intersection(prevMarkerIds)
.map(idToCurrentMarker)
.toSet();
final Set<Marker> _markersToChange =
currentMarkersSet.difference(previousMarkersSet);
Comment thread
KlausJokisuo marked this conversation as resolved.
Outdated

markersToAdd = _markersToAdd;
markerIdsToRemove = _markerIdsToRemove;
Expand Down