GridCell class

Represents a discrete cell in a 2D spatial partitioning grid

This class is used for spatial hashing and efficient neighbor lookups in particle systems. Each GridCell corresponds to a fixed-size region in the continuous coordinate space.

Key Features:

  • Immutable coordinates (safe for hash-based collections)
  • Proper equality and hash code implementation
  • Human-readable string representation

Mathematical Basis: Continuous space → Discrete grid mapping: cellX = floor(worldX / cellSize) cellY = floor(worldY / cellSize)

Constructors

GridCell(int x, int y)
Creates a grid cell with discrete coordinates

Properties

hashCode int
Hash code implementation following Dart's hash code contract:
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
x int
The x-coordinate of the grid cell (discrete grid space, not world space)
final
y int
The y-coordinate of the grid cell (discrete grid space, not world space)
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Human-readable string representation for debugging
override

Operators

operator ==(Object other) bool
Equality operator that compares both coordinates
override