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

A Flutter plugin to use Google's ML Kit Barcode Scanning to read data encoded using most standard barcode formats.

Google's ML Kit Barcode Scanning for Flutter #

Pub Version analysis Star on Github License: MIT

A Flutter plugin to use Google's ML Kit Barcode Scanning to read data encoded using most standard barcode formats.

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.boundingBox;
  final String displayValue = barcode.displayValue;
  final String rawValue = barcode.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 #

Find the example app here.

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.

90
likes
0
pub points
97%
popularity

Publisher

verified publisherflutter-ml.dev

A Flutter plugin to use Google's ML Kit Barcode Scanning to read data encoded using most standard barcode formats.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, google_mlkit_commons

More

Packages that depend on google_mlkit_barcode_scanning