getZone static method

int getZone({
  1. int? index,
  2. int? row,
  3. int? col,
})

Implementation

static int getZone({int? index, int? row, int? col}) {
  if (index == null) {
    if (col == null || row == null) {
      throw StateError("index or (col and row) can't be null");
    }
  } else {
    row = getRow(index);
    col = getCol(index);
  }

  int x = col ~/ 3;
  int y = row ~/ 3;
  return y * 3 + x;
}