set method
- Pos pos,
- E value
Sets the element at a position in the grid.
The position must be within the bounds of the grid.
Example
final grid = Grid.filled(2, 2, 0);
final pos = Pos(1, 1);
grid.set(pos, 1);
print(grid.get(pos)); // 1
Implementation
void set(Pos pos, E value) {
if (!containsPos(pos)) {
throw RangeError('Position $pos is out of bounds');
}
setUnsafe(pos, value);
}