verifyBytes method

void verifyBytes(
  1. Uint8List data
)

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 Set<int> chr = charSet.toSet();

  for (final int code in data) {
    if (!chr.contains(code)) {
      throw BarcodeException('Unable to encode "${String.fromCharCode(code)}" to $name Barcode');
    }
  }
}