Skip to content

Commit 7088758

Browse files
authored
Implement MapCamera equality & hashCode (#1614)
This will ensure assertions like the one described in #1613 work as intended
1 parent 771d4c2 commit 7088758

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/src/map/camera/camera.dart

+16
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,20 @@ class MapCamera {
361361
final newCenter = unproject(mapCenter + newOffset);
362362
return newCenter;
363363
}
364+
365+
@override
366+
int get hashCode => Object.hash(
367+
crs, minZoom, maxZoom, center, zoom, rotation, nonRotatedSize);
368+
369+
@override
370+
bool operator ==(Object other) =>
371+
identical(other, this) ||
372+
(other is MapCamera &&
373+
other.crs == crs &&
374+
other.minZoom == minZoom &&
375+
other.maxZoom == maxZoom &&
376+
other.center == center &&
377+
other.zoom == zoom &&
378+
other.rotation == rotation &&
379+
other.nonRotatedSize == nonRotatedSize);
364380
}

0 commit comments

Comments
 (0)