verifyBytes method

  1. @override
void verifyBytes(
  1. Uint8List data
)
override

Implementation

@override
void verifyBytes(Uint8List data) {
  String text = utf8.decoder.convert(data);

  if (fixedLength != null) {
    text = checkLength(text, maxLength);
  } else {
    if (zeroPrepend && ((text.length % 2 != 0) != addChecksum)) {
      text = "0$text";
    }

    if (addChecksum) {
      text += checkSumModulo10(text);
    }
  }

  if (text.length % 2 != 0) {
    throw BarcodeException("$name barcode can only encode an even number of digits.");
  }

  super.verifyBytes(utf8.encoder.convert(text));
}