Flutter Barcode Scanner SDK

Add offline 1D and 2D barcode scanning to your Flutter mobile app for Android and iOS. Install the MIT-licensed qr_barcode_scanner package from pub.dev, run native Rust decoding off the UI isolate and return exact identifier strings with their symbology.

Dart
import 'package:qr_barcode_scanner/qr_barcode_scanner.dart';

await QrcodeAiScanner.init();
final report = await QrcodeAiScanner.scan(imageBytes, profile: 'frame');
final codes = report.detections.where((d) => d.symbology == Symbology.code128);
final barcode = codes.isEmpty ? null : codes.first;

print(barcode?.content.text);

Inspect the decoded identifierSTOCK-4827

Read label images

Pass PNG, JPEG, WebP or GIF bytes to QrcodeAiScanner.scan(). A Code 128 label encoding STOCK-4827 returns that exact string.

Shell
flutter pub add qr_barcode_scanner

Need to scan a barcode straight away? Open the online reader

Flutter Barcode Scanner SDK at a glance

  • Verified publisher qrcode-ai.com

    pub.dev

  • Native Rust via flutter_rust_bridge

    Android + iOS

  • EAN, UPC, Code 128, Data Matrix & more

    1D + 2D

  • Open-source licence

    MIT

Bring offline barcode scanning to Flutter

Decode 1D retail, warehouse and 2D matrix labels on Android and iOS without blocking the Flutter UI isolate.

Read label images

Pass PNG, JPEG, WebP or GIF bytes to QrcodeAiScanner.scan(). A Code 128 label encoding STOCK-4827 returns that exact string.

Scan RGBA camera frames

Pass raw RGBA pixels to QrcodeAiScanner.scanFrame() on the Rust worker pool while your Flutter app owns camera capture and UI.

Keep exact strings & formats

Read each detection’s Symbology enum and content.text string so leading zeros remain intact, then query your own stock backend.

Add barcode image reading in Flutter

Add qr_barcode_scanner from pub.dev, initialise the bridge once and decode barcode labels off the UI isolate.

Add qr_barcode_scanner from pub.dev

Install qr_barcode_scanner on pub.dev under verified publisher qrcode-ai.com. Current releases ship cargokit metadata for Ed25519-signed pre-compiled libraries on Android (four ABIs) and iOS or source builds.

Platform toolchain note: iOS builds cleanly (with a Swift Package Manager warning only). On Android, current Flutter 3.50 toolchains requiring AGP 9.1.1+ and Gradle 9.3.1+ fail inside cargokit because Gradle 9 removed Project.exec(); use a Gradle 8 Android toolchain or check the Flutter README for the Gradle 9 cargokit fix before upgrading.

Shell
flutter pub add qr_barcode_scanner

Without rustup, cargokit downloads signed pre-compiled binaries automatically. With rustup installed, set use_precompiled_binaries: true in cargokit_options.yaml next to pubspec.yaml to skip compiling Rust.

Building from source requires Rust 1.88+ and Android NDK r28+ (for 16 KB memory page alignment).

Decode a barcode label off the UI isolate

Call QrcodeAiScanner.init() once, then await QrcodeAiScanner.scan() with label image bytes and keep the barcode symbologies your app requires.

To test with a known fixture, create a Code 128 barcode with Barcode Generator containing STOCK-4827 and scan the exported PNG.

Dart
import 'dart:typed_data';
import 'package:qr_barcode_scanner/qr_barcode_scanner.dart';

Future<List<({Symbology symbology, String text})>> readBarcodes(Uint8List bytes) async {
  await QrcodeAiScanner.init();
  final report = await QrcodeAiScanner.scan(bytes, profile: 'frame');
  if (report.trace.budgetExhausted == true) {
    return const [];
  }
  return report.detections
      .where((d) => d.symbology != Symbology.qrCode && !d.content.charset.isLossy)
      .map((d) => (symbology: d.symbology, text: d.content.text))
      .toList();
}

Switch profile to 'full' or pass budgetMs: 0 for worn or low-contrast labels (and during slow debug simulator runs).

For live camera scanning, pass raw RGBA pixels to QrcodeAiScanner.scanFrame(rgba, width, height) while your app manages camera permissions.

Inspect the decoded identifier

For a Code 128 label encoding STOCK-4827, readBarcodes resolves to [(symbology: Symbology.code128, text: 'STOCK-4827')]. A UPC-A code such as 012345678905 keeps its leading zero intact as a Dart String.

A blank image or QR-only photo returns an empty list. Invalid image bytes throw an error ending in [QRS-xxx]; negative budgetMs throws RangeError before native execution.

Barcode coverage, cargokit binaries and typed reports

Sixteen barcode formats. Decodes EAN-13, EAN-8, UPC-A, UPC-E, Code 128, Code 39, Code 93, Codabar, ITF, Telepen, GS1 DataBar, GS1 DataBar Expanded, Data Matrix, PDF417, Aztec and MaxiCode (ISBN maps to ean13, GS1-128 to code128, ITF-14 to itf).

Signed binaries and simulator budgets. Cargokit verifies Ed25519 signatures on pre-compiled libraries for Android (four ABIs) and iOS before falling back to Rust 1.88+ / NDK r28+ source builds. Use budgetMs: 0 if debug simulators hit budgetExhausted.

Strings and MIT licence. Keep values as Dart String so leading zeros survive and query product catalogues separately. Current releases are MIT-licensed; see the Flutter binding README and Flutter API guide.

Flutter Barcode Scanner documentation and licence

Official package documentation, ScanReport specification and licensing references.

Flutter Barcode Scanner SDK questions

pub.dev, formats, leading zeros, cargokit binaries, UI isolate and licensing.

It is QR Code AI’s open-source MIT-licensed Flutter package (qr_barcode_scanner on pub.dev under verified publisher qrcode-ai.com) for decoding 16 1D and 2D barcode formats plus QR codes on Android and iOS via flutter_rust_bridge.

It decodes EAN-13, EAN-8, UPC-A, UPC-E, Code 128, Code 39, Code 93, Codabar, ITF, Telepen, GS1 DataBar, GS1 DataBar Expanded, Data Matrix, PDF417, Aztec and MaxiCode, plus QR Code, Micro QR and rMQR.

Not when signed pre-compiled binaries are used. Without rustup, cargokit downloads and verifies Ed25519-signed libraries automatically; with rustup installed, set use_precompiled_binaries: true in cargokit_options.yaml or build from source with Rust 1.88+ and Android NDK r28+.

No. Each detection returns its Symbology enum and exact content.text String (plus parsed GS1 payload fields when present), keeping leading zeros intact. Product catalogue lookups stay in your own backend or database.

iOS builds and runs cleanly (displaying only a Swift Package Manager warning). On Android, projects using Flutter 3.50 with AGP 9.1.1+ and Gradle 9.3.1+ fail during compilation because cargokit still calls Project.exec(), which Gradle 9 removed; use a Gradle 8 Android toolchain or check the Flutter README for the Gradle 9 fix before targeting Gradle 9.

A blank image returns an empty detections list (confirm report.trace.budgetExhausted is false; pass budgetMs: 0 on slow debug simulators). Invalid image bytes throw an error ending in [QRS-xxx].

No. Decoding runs locally on the device off the Dart UI isolate with no Google Play Services dependency, no hosted API calls, no QR Code AI account, no API key and no creation credits.

Yes. Current releases are MIT-licensed for commercial and proprietary mobile apps while preserving copyright and licence notices (see LICENSING.md). SDK use is separate from QR Code AI’s paid creation plans and seven-day Premium trial.