operator == method
Equality operator that compares both coordinates
Essential for correct behavior in collections like Set and Map. Follows Dart's equality contract:
- Reflexive: a == a
- Symmetric: a == b ⇒ b == a
- Transitive: a == b && b == c ⇒ a == c
Implementation
@override
bool operator ==(Object other) =>
identical(this, other) || // Reference equality check
other is GridCell && // Type check
runtimeType == other.runtimeType && // Subtype check
x == other.x && // Coordinate comparison
y == other.y;