Flutter QR Code Scanner SDK

Add offline QR code 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 through flutter_rust_bridge and inspect typed Dart reports.

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.qrCode);
final qr = codes.isEmpty ? null : codes.first;

print(qr?.content.text);

Inspect the decoded resulthttps://qrcode-ai.com/

Read saved QR images

Pass PNG, JPEG, WebP or GIF bytes to QrcodeAiScanner.scan() and get a typed Dart ScanReport with URLs, text and QR diagnostics.

Shell
flutter pub add qr_barcode_scanner

Need to scan a code right now? Open the online reader

Flutter QR Code Scanner SDK at a glance

  • Verified publisher qrcode-ai.com

    pub.dev

  • Native Rust via flutter_rust_bridge

    Android + iOS

  • Runs locally on Rust worker pool

    Off UI isolate

  • Open-source licence

    MIT

Bring offline QR scanning to Flutter

Connect image pickers or camera RGBA frames to the native Rust engine on Android and iOS without blocking the Flutter UI isolate.

Read saved QR images

Pass PNG, JPEG, WebP or GIF bytes to QrcodeAiScanner.scan() and get a typed Dart ScanReport with URLs, text and QR diagnostics.

Scan RGBA camera frames

Pass width*height*4 RGBA pixels to QrcodeAiScanner.scanFrame() on flutter_rust_bridge’s Rust worker pool while your app owns camera UI.

Typed Dart ScanReport

Inspect detections, a typed Payload sealed class, ISO 15415 / UEC grade cards, hints and trace.budgetExhausted with forward-safe enums.

Add QR image reading in Flutter

Add qr_barcode_scanner from pub.dev, initialise the native bridge once and decode image bytes asynchronously.

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 so apps can download Ed25519-signed precompiled libraries for Android (4 ABIs) and iOS (devices and simulators) or compile from bundled Rust sources.

Platform toolchain note: iOS builds cleanly (showing only a Swift Package Manager warning). 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(); stay on 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 installed, cargokit uses signed precompiled binaries by default. With rustup installed, add use_precompiled_binaries: true in cargokit_options.yaml beside pubspec.yaml to skip local Rust builds.

When building from source, install Rust 1.88+ and Android NDK r28+ (NDK r28 enforces 16 KB page alignment; NDK r27 produces 4 KB alignment).

Decode a QR image off the UI isolate

Call QrcodeAiScanner.init() once at app startup, then await QrcodeAiScanner.scan() with PNG, JPEG, WebP or GIF bytes. Decoding runs on flutter_rust_bridge’s worker pool so animations and touch gestures stay smooth.

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

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

Default budgets are full (4000 ms), fast (800 ms) and frame (80 ms); pass budgetMs: 0 for an unbounded scan, especially on slower debug simulators.

For live camera capture, call QrcodeAiScanner.scanFrame(rgba, width, height) with raw RGBA pixels while your app handles camera permissions and preview widgets.

Inspect the decoded result

For a QR image encoding https://qrcode-ai.com/, readQrImage resolves to ['https://qrcode-ai.com/']. Check report.score for QR quality grades (null means unmeasured, never zero).

When no QR code is found, the SDK returns an empty detections list rather than throwing. Invalid image bytes throw an error containing [QRS-xxx]; negative budgetMs throws RangeError before calling native code.

Cargokit binaries, typed reports and simulator notes

Signed binaries and toolchains. Cargokit verifies Ed25519 signatures on precompiled libraries for Android (armeabi-v7a, arm64-v8a, x86, x86_64) and iOS before falling back to local compilation with Rust 1.88+ and Android NDK r28+.

Typed Dart models and budgets. ScanReport parses additive fields forward-safely without throwing; verify content.charset.isLossy before reading content.text, and pass budgetMs: 0 if slow debug emulators hit budgetExhausted.

App-owned UI and MIT licence. Your Flutter app manages camera plugins, permission dialogues and overlays. Current releases are MIT-licensed; see the Flutter binding README and Flutter API guide.

Flutter QR Code Scanner documentation and licence

Official package documentation, ScanReport specification and licensing references.

Flutter QR Code Scanner SDK questions

pub.dev, precompiled libraries, NDK r28, UI isolate, budgets 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) that connects Android and iOS Flutter apps to the native Rust engine through flutter_rust_bridge.

Not when signed precompiled binaries are available for your release. Without rustup on your laptop, cargokit downloads and verifies Ed25519-signed libraries automatically; if rustup is installed, set use_precompiled_binaries: true in cargokit_options.yaml or compile with Rust 1.88+ and Android NDK r28+.

No. The package handles native image and RGBA frame decoding only. Your Flutter app selects its own camera or image picker plugin, manages runtime permission dialogues and renders previews or result actions.

Emulators and simulators execute Flutter in debug mode on virtualised CPUs, where default fast (800 ms) or frame (80 ms) budgets can expire on shared machines. Pass budgetMs: 0 for unbounded scans while debugging and verify strict budgets on physical phones in release mode.

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; stay on a Gradle 8 Android toolchain or check the Flutter README for the Gradle 9 fix before targeting Gradle 9.

ScanReport is additively forward-compatible (unknown enum values map to unknown or unrecognized without throwing). An image with no code returns an empty detections list; unreadable files throw an error message ending in [QRS-xxx].

Yes. Once compiled into your app, all decoding runs locally offline on the device off the Dart UI isolate, with no hosted API calls, no API key, no QR Code AI account and no creation credits.

Yes. Current releases are published under the MIT licence, permitting commercial and proprietary Flutter mobile apps while retaining copyright and licence notices (see LICENSING.md). SDK use is independent of QR Code AI’s paid creation plans and seven-day Premium trial.