operator == method

  1. @override
bool operator ==(
  1. Object other
)
override

Checks if two Location instances are equal.

Two locations are considered equal if their coordinates are identical within a small tolerance (1e-6 degrees).

Implementation

@override
bool operator ==(Object other) {
  if (identical(this, other)) return true;
  if (other is! Location) return false;

  const double tolerance = 1e-6;
  return (lat - other.lat).abs() < tolerance &&
         (lng - other.lng).abs() < tolerance;
}