Flutter QR Code Scanner SDK

Run offline QR code scanning inside your Flutter mobile app for Android and iOS. Install the MIT-licensed qr_barcode_scanner package from pub.dev, execute native Rust decoding off the UI isolate via 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 receive a typed Dart ScanReport with URLs, text and QR diagnostics.

Shell
flutter pub add qr_barcode_scanner

Need to scan a code 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

Run offline QR scanning in Flutter

Wire image pickers or camera RGBA frames into the native Rust engine on Android and iOS without blocking the UI isolate.

Read saved QR images

Pass PNG, JPEG, WebP or GIF bytes to QrcodeAiScanner.scan() and receive 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 manages 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.

Set up 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 fetch 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 patch before upgrading.

Shell
flutter pub add qr_barcode_scanner

Without rustup installed, cargokit uses signed precompiled binaries by default. When rustup is installed, set use_precompiled_binaries: true in cargokit_options.yaml beside pubspec.yaml to skip local Rust compilation.

To build from source, install Rust 1.88+ and Android NDK r28+ (NDK r28 enforces 16 KB page alignment; NDK r27 outputs 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 executes on flutter_rust_bridge’s worker pool so animations and gestures stay responsive.

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, particularly 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 detections list is empty and nothing is thrown. Invalid image bytes throw an error containing [QRS-xxx]; negative budgetMs throws RangeError before reaching 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; check content.charset.isLossy before reading content.text, and pass budgetMs: 0 when slower debug emulators hit budgetExhausted.

App-owned UI and MIT licence. Your Flutter app controls camera plugins, permissions and overlays. Current releases carry the MIT licence; review 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) linking Android and iOS Flutter mobile apps to the native Rust engine via flutter_rust_bridge.

Not when signed precompiled binaries are published for your release. Without rustup, cargokit downloads and checks Ed25519-signed libraries automatically; if rustup is installed, set use_precompiled_binaries: true in cargokit_options.yaml or build from source with Rust 1.88+ and Android NDK r28+.

No. The package focuses strictly on native image and RGBA frame decoding. Your Flutter app selects its camera or image picker plugin, presents runtime permission dialogues and renders previews or result actions.

Emulators and simulators run Flutter in debug mode on virtualised CPUs, where default fast (800 ms) or frame (80 ms) budgets can run out on shared runners. Pass budgetMs: 0 for unbounded scans during debugging and verify tight budgets on physical mobile devices in release mode.

iOS builds and runs cleanly (showing only a Swift Package Manager warning). On Android, projects on 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 patch before upgrading.

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 ending in [QRS-xxx].

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

Yes. Current releases carry the MIT licence, permitting commercial and proprietary apps while retaining copyright and licence notices (see LICENSING.md). SDK use is separate from QR Code AI’s paid creation plans and seven-day Premium trial.