getRSBlocks static method

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

Implementation

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

  final int length = rsBlock.length ~/ 3;

  final List<QrRsBlock> list = <QrRsBlock>[];

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

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

  return list;
}