Barcode.code39 constructor

Barcode.code39(
  1. List barcodeData
)

CODE39

k >= 1 d: '0'–'9', A–Z, SP, $, %, *, +, -, ., /

Implementation

Barcode.code39(List<dynamic> barcodeData) {
  final k = barcodeData.length;
  if (k < 1) {
    throw Exception('Barcode: Wrong data range');
  }

  final regex = RegExp(r'^[0-9A-Z \$\%\*\+\-\.\/]$');
  final bool isDataValid =
      barcodeData.every((dynamic d) => regex.hasMatch(d.toString()));
  if (!isDataValid) {
    throw Exception('Barcode: Data is not valid');
  }

  _type = BarcodeType.code39;
  _data = _convertData(barcodeData);
}