verifyBytes method
Check if the Barcode is valid. Throws BarcodeException with a proper message in case of error
Implementation
void verifyBytes(Uint8List data) {
if (data.length > maxLength) {
throw BarcodeException(
'Unable to encode "$data", maximum length is $maxLength for $name Barcode');
}
if (data.length < minLength) {
throw BarcodeException(
'Unable to encode "$data", minimum length is $minLength for $name Barcode');
}
final chr = charSet.toSet();
for (var code in data) {
if (!chr.contains(code)) {
throw BarcodeException(
'Unable to encode "${String.fromCharCode(code)}" to $name Barcode');
}
}
}