getUnsafe abstract method

E getUnsafe(
  1. Pos pos
)

Returns the element at a position in the grid.

If the position is not within the bounds of the grid, the behavior is undefined. This method is intended to be used in cases where the position can be trusted, such as an iterator or other trusted synchronous operations.

Example

final grid = Grid.fromRows(
  empty: Tile.wall,
  [
    [Tile.wall, Tile.wall, Tile.wall],
    [Tile.wall, Tile.floor, Tile.wall],
  ],
);

for (var y = 0; y < grid.height; y++) {
  for (var x = 0; x < grid.width; x++) {
    final pos = Pos(x, y);
    print(grid.getUnsafe(pos));
  }
}

Implementation

E getUnsafe(Pos pos);