Barcode.fromType constructor

Barcode.fromType(
  1. BarcodeType type
)

Create a specific Barcode instance based on the BarcodeType this uses only the default barcode settings. For finer-grained usage, use the static methods:

  • Barcode.code39()
  • Barcode.code93()
  • Barcode.code128()
  • ...

Implementation

factory Barcode.fromType(BarcodeType type) {
  switch (type) {
    case BarcodeType.Code39:
      return Barcode.code39();
    case BarcodeType.Code93:
      return Barcode.code93();
    case BarcodeType.Code128:
      return Barcode.code128();
    case BarcodeType.GS128:
      return Barcode.gs128();
    case BarcodeType.Itf:
      return Barcode.itf();
    case BarcodeType.CodeITF14:
      return Barcode.itf14();
    case BarcodeType.CodeITF16:
      return Barcode.itf16();
    case BarcodeType.CodeEAN13:
      return Barcode.ean13();
    case BarcodeType.CodeEAN8:
      return Barcode.ean8();
    case BarcodeType.CodeEAN5:
      return Barcode.ean5();
    case BarcodeType.CodeEAN2:
      return Barcode.ean2();
    case BarcodeType.CodeISBN:
      return Barcode.isbn();
    case BarcodeType.CodeUPCA:
      return Barcode.upcA();
    case BarcodeType.CodeUPCE:
      return Barcode.upcE();
    case BarcodeType.Telepen:
      return Barcode.telepen();
    case BarcodeType.Codabar:
      return Barcode.codabar();
    case BarcodeType.Rm4scc:
      return Barcode.rm4scc();
    case BarcodeType.QrCode:
      return Barcode.qrCode();
    case BarcodeType.PDF417:
      return Barcode.pdf417();
    case BarcodeType.DataMatrix:
      return Barcode.dataMatrix();
    case BarcodeType.Aztec:
      return Barcode.aztec();
    default:
      throw UnimplementedError('Barcode $type not supported');
  }
}