equal method
Returns true
if the given position is at the same position
(within a small margin of error).
The margin of error can be overridden by setting maxMargin
to a small number.
can accept other: LatLng(20.0, 30.0) or other: 20.0, 30.0
Implementation
@override
bool equal(other, [maxMargin = 0.0001]) {
if (other == null) {
return false;
}
LatLng o = LatLng.from(other);
double margin = math.max(
(lat - o.lat).abs(),
(lng - o.lng).abs(),
);
margin = math.max(margin, (alt - o.alt).abs());
return margin <= maxMargin;
}