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;
}