Barcode.ean8 constructor
Barcode.ean8(
- List barcodeData
JAN8 (EAN8)
k = 7, 8 d = '0' – '9'
Implementation
Barcode.ean8(List<dynamic> barcodeData) {
final k = barcodeData.length;
if (![7, 8].contains(k)) {
throw Exception('Barcode: Wrong data range');
}
final numeric = RegExp(r'^[0-9]$');
final bool isDataValid =
barcodeData.every((dynamic d) => numeric.hasMatch(d.toString()));
if (!isDataValid) {
throw Exception('Barcode: Data is not valid');
}
_type = BarcodeType.ean8;
_data = _convertData(barcodeData);
}