google_mlkit_barcode_scanning 0.0.1 copy "google_mlkit_barcode_scanning: ^0.0.1" to clipboard
google_mlkit_barcode_scanning: ^0.0.1 copied to clipboard

outdated

A Flutter Plugin for ML Kit - Barcode scanning.

Google's ML Kit Barcode Scanning for Flutter #

Pub Version

A Flutter plugin to use Google's ML Kit Barcode Scanning.

Getting Started #

Before you get started read about the requirements and known issues of this plugin here.

Usage #

Barcode scanning #

Create an instance of InputImage

Create an instance of InputImage as explained here.

final InputImage inputImage;

Create an instance of BarcodeScanner

final List<BarcodeFormat> formats = [BarcodeFormat.all, ...];
final barcodeScanner = BarcodeScanner(formats: formats);

Process image

final List<Barcode> barcodes = await barcodeScanner.processImage(inputImage);

for (Barcode barcode in barcodes) {
  final BarcodeType type = barcode.type;
  final Rect boundingBox = barcode.value.boundingBox;
  final String displayValue = barcode.value.displayValue;
  final String rawValue = barcode.value.rawValue;

  // See API reference for complete list of supported types
  switch (type) {
    case BarcodeType.wifi:
      BarcodeWifi barcodeWifi = barcode.value;
      break;
    case BarcodeValueType.url:
      BarcodeUrl barcodeUrl = barcode.value;
      break;
  }
}

Release resources with close()

barcodeScanner.close();

Example app #

Look at this example to see the plugin in action.

Contributing #

Contributions are welcome. In case of any problems look at existing issues, if you cannot find anything related to your problem then open an issue. Create an issue before opening a pull request for non trivial fixes. In case of trivial fixes open a pull request directly.