getCodewordNearby method

Codeword? getCodewordNearby(
  1. int imageRow
)

Implementation

Codeword? getCodewordNearby(int imageRow) {
  Codeword? codeword = getCodeword(imageRow);
  if (codeword != null) {
    return codeword;
  }
  for (int i = 1; i < _maxNearbyDistance; i++) {
    int nearImageRow = imageRowToCodewordIndex(imageRow) - i;
    if (nearImageRow >= 0) {
      codeword = _codewords[nearImageRow];
      if (codeword != null) {
        return codeword;
      }
    }
    nearImageRow = imageRowToCodewordIndex(imageRow) + i;
    if (nearImageRow < _codewords.length) {
      codeword = _codewords[nearImageRow];
      if (codeword != null) {
        return codeword;
      }
    }
  }
  return null;
}