getRSBlocks static method

List<QRRSBlock> getRSBlocks(
  1. int typeNumber,
  2. int errorCorrectLevel
)

Implementation

static List<QRRSBlock> getRSBlocks(int typeNumber, int errorCorrectLevel) {
  final rsBlock = _getRsBlockTable(typeNumber, errorCorrectLevel);

  final length = rsBlock.length ~/ 3;

  final list = <QRRSBlock>[];

  for (var i = 0; i < length; i++) {
    final count = rsBlock[i * 3 + 0];
    final totalCount = rsBlock[i * 3 + 1];
    final dataCount = rsBlock[i * 3 + 2];

    for (var j = 0; j < count; j++) {
      list.add(QRRSBlock._(totalCount, dataCount));
    }
  }

  return list;
}