decodeRow2pairs method
Implementation
List<ExpandedPair> decodeRow2pairs(int rowNumber, BitArray row) {
_pairs.clear();
bool done = false;
while (!done) {
try {
_pairs.add(retrieveNextPair(row, _pairs, rowNumber)!);
} on NotFoundException catch (_) {
if (_pairs.isEmpty) {
rethrow;
}
// exit this loop when retrieveNextPair() fails and throws
done = true;
}
}
if (_checkChecksum() && _isValidSequence(_pairs, true)) {
return _pairs;
}
final tryStackedDecode = _rows.isNotEmpty;
_storeRow(rowNumber); // TODO: deal with reversed rows
if (tryStackedDecode) {
// When the image is 180-rotated, then rows are sorted in wrong direction.
// Try twice with both the directions.
List<ExpandedPair>? ps = _checkRows(false);
if (ps != null) {
return ps;
}
ps = _checkRows(true);
if (ps != null) {
return ps;
}
}
throw NotFoundException.instance;
}