getErrorCorrectionCodewordCount static method

int getErrorCorrectionCodewordCount(
  1. int errorCorrectionLevel
)

Determines the number of error correction codewords for a specified error correction level.

@param errorCorrectionLevel the error correction level (0-8) @return the number of codewords generated for error correction

Implementation

static int getErrorCorrectionCodewordCount(int errorCorrectionLevel) {
  if (errorCorrectionLevel < 0 || errorCorrectionLevel > 8) {
    throw ArgumentError('Error correction level must be between 0 and 8!');
  }
  return 1 << (errorCorrectionLevel + 1);
}