Barcode.parsBarcode constructor

Barcode.parsBarcode({
  1. required String barcode,
})

The most easy way to pars your Barcode just put you barcode as value and you will get all what you need

Implementation

Barcode.parsBarcode({required String barcode}) {
  int last = barcode.length - 1;
  String checkSum = barcode.substring(last);
  String product = barcode.substring(last - 5, last);
  String company = barcode.substring(last - 9, last - 5);
  String country = barcode.substring(0, last - 9);

  this.barcode = barcode;
  this.country = int.parse(country);
  this.company = int.parse(company);
  this.product = int.parse(product);
  this.checkSum = int.parse(checkSum);

  _intCountry();
}