Add Coordinate getter documentation
This commit is contained in:
parent
5a72783d57
commit
5725757aa0
1 changed files with 6 additions and 0 deletions
|
@ -21,6 +21,12 @@ class Grid<E> extends DelegatingList<E> {
|
|||
height = h,
|
||||
super(l);
|
||||
|
||||
/// Return element at coordinate position
|
||||
///
|
||||
/// Returns the corresponding element after checking the parameters
|
||||
/// for the correct constraints along the width and height of the grid.
|
||||
/// Throws [RangeError] if outside of constraints. Preferred method
|
||||
/// to access elements via coordinates.
|
||||
E get(int x, int y) {
|
||||
int i = toIndex(x, y);
|
||||
if (i >= length || x > width - 1) throw RangeError.index(i, this);
|
||||
|
|
Loading…
Reference in a new issue