jumpToCell method

void jumpToCell(
  1. int row,
  2. int col
)

Jumps to a specific cell by row and column.

If the cell is out of bounds, jumps to the nearest valid cell.

Implementation

void jumpToCell(int row, int col) {
  if (_itemCount == 0) return;
  final targetRow = row.clamp(0, rows - 1);
  final targetCol = col.clamp(0, _columns - 1);
  final index = targetRow * _columns + targetCol;
  jumpTo(index);
}