verifyBytes method
Check if the Barcode is valid. Throws BarcodeException with a proper message in case of error
Implementation
@override
void verifyBytes(Uint8List data) {
var 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));
}