Skip to content

Commit

Permalink
Implement MapCamera equality & hashCode (#1614)
Browse files Browse the repository at this point in the history
This will ensure assertions like the one described in #1613 work as intended
  • Loading branch information
jjoelson authored Aug 15, 2023
1 parent 771d4c2 commit 7088758
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/src/map/camera/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,20 @@ class MapCamera {
final newCenter = unproject(mapCenter + newOffset);
return newCenter;
}

@override
int get hashCode => Object.hash(
crs, minZoom, maxZoom, center, zoom, rotation, nonRotatedSize);

@override
bool operator ==(Object other) =>
identical(other, this) ||
(other is MapCamera &&
other.crs == crs &&
other.minZoom == minZoom &&
other.maxZoom == maxZoom &&
other.center == center &&
other.zoom == zoom &&
other.rotation == rotation &&
other.nonRotatedSize == nonRotatedSize);
}

0 comments on commit 7088758

Please sign in to comment.