6 Best Barcode and QR Packages for Flutter

Following are the best Flutter libraries for generating and scanning barcodes:

Create barcode

barcode

barcode is a Dart library which can generate generic drawing operations. It is the base to create flutter widgets or pdf barcodes. There are many packages which depend on this package to generate pdf, SVG barcodes.

// Create a DataMatrix barcode
final dm = Barcode.dataMatrix();

final me = MeCard.wifi(
  ssid: 'My Neighbor Wifi ',
  password: 'somelongpasswith12345',
);

// Generate a SVG with a barcode that configures the wifi access
final svg = bc.toSvg(me.toString(), width: 300, height: 300);

// Save the image
await File('neighbor_wifi.svg').writeAsString(svg);

It supports both 1D and 2D barcodes.

barcode_widget

This widget uses pub:barcode (the library above) to generate any supported barcodes.

BarcodeWidget(
  barcode: Barcode.ean13(),
  data: 'EAN14 format product code data',
  errorBuilder: (context, error) => Center(child: Text(error)),
);

Scan barcode

flutter_barcode_scanner

This is a barcode scanning package which supports scanning of 1D barcodes, QR codes on Android and iOS.

String barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
                                                    COLOR_CODE, 
                                                    CANCEL_BUTTON_TEXT, 
                                                    isShowFlashIcon, 
                                                    scanMode);

qrscan

This is a simple plugin to scan for QR code. It supports scanning BR-CODE or QR-CODE.

import 'package:qrscan/qrscan.dart' as scanner;

String cameraScanResult = await scanner.scan();

qr_flutter

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.

QrImage(
  data: "22345678910",
  version: QrVersions.auto,
  size: 300.0,
),

qr_code_scanner

This is a QR code scanner that can be embedded inside Flutter that works on both iOS and Android.

class _QRViewExampleState extends State<QRViewExample> {
  final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
  var qrText = "";
  QRViewController controller;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: <Widget>[
          Expanded(
            flex: 5,
            child: QRView(
              key: qrKey,
              onQRViewCreated: _onQRViewCreated,
            ),
          ),
          Expanded(
            flex: 1,
            child: Center(
              child: Text('Scan result: $qrText'),
            ),
          )
        ],
      ),
    );
  }

  void _onQRViewCreated(QRViewController controller) {
    this.controller = controller;
    controller.scannedDataStream.listen((scanData) {
      setState(() {
        qrText = scanData;
      });
    });
  }

  @override
  void dispose() {
    controller?.dispose();
    super.dispose();
  }
}

Leave a Comment

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close