qr_barcode_scanner 0.12.2
qr_barcode_scanner: ^0.12.2 copied to clipboard
Scan QR codes and barcodes locally from images or camera frames, with versioned reports and QR scannability diagnostics from the native Rust engine.
qr_barcode_scanner — Flutter / Dart #
Ask AI #
Choose an AI assistant to explain this destination using its public sources. Gemini opens gemini.google.com. Gemini, Copilot, DeepSeek, Meta AI and Qwen require pasting the prompt below; the other links include it in their URL. Sign-in or a manual paste may still be required. Check the answer against the documentation.
Copy the plain-text prompt
Use the code block's copy control, or select its complete text, then paste it into your assistant.
Help me understand qr_barcode_scanner — Flutter / Dart (bindings/flutter/README.md) for QR Code & Barcode Scanner, the open-source scanner. Source documentation; publication is not implied. Provided README context (verify against the sources): Use the Flutter binding to connect image import or application-supplied RGBA frames to the shared native scanner. The package supplies decoding and report data; your app owns camera acquisition, permissions, preview and the response to decoded content. Follow the source packaging instructions below when evaluating an upcoming version instead of assuming that published and working-source archives are identical. Read the public documentation below. Explain what this destination does, its documented installation or access steps, a minimal example if supported, prerequisites, limitations and license. Distinguish published packages from working source and preparation. Cite your sources; if a page is unavailable or a fact cannot be checked, say so. Do not invent installation commands, benchmark results or comparisons. Answer in my language. Public sources: https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/bindings/flutter/README.md https://qrcode-ai.com/en-US/qr-code-scanner https://qrcode-ai.com/en-US/barcode-scanner https://qrcode-ai.com/en-US/qr-code-scanner/sdk/flutter https://qrcode-ai.com/en-US/barcode-scanner/sdk/flutter https://qrcode-ai.com/en-US/qr-code-generator https://qrcode-ai.com/en-US/barcode-generator
Use the Flutter binding to connect image import or application-supplied RGBA frames to the shared native scanner. The package supplies decoding and report data; your app owns camera acquisition, permissions, preview and the response to decoded content. Follow the source packaging instructions below when evaluating an upcoming version instead of assuming that published and working-source archives are identical.
The QR code scanner and barcode scanner are QR Code AI’s browser scanning entry points. For the corresponding development route, the QR code scanner Flutter guide and barcode scanner Flutter guide connect this documentation to the two product journeys. If a product page is unavailable, the instructions and references in this README remain the starting point for this source directory.
To prepare an image to import into a Flutter screen, use the QR code generator or the barcode generator. Keep the original payload with the exported image so that you can compare the scan result with the value you intended to encode.
Scan QR codes and barcodes locally from encoded images or RGBA camera frames.
QR reports include scannability diagnostics when the selected profile measures
them. The native Rust core of
qrcode-barcode-scanner
also decodes barcodes and connects to Flutter via
flutter_rust_bridge.
Returns the same versioned ScanReport as the Python / Node / WASM / Kotlin /
Swift bindings (one serde wire contract).
Install #
Public Flutter package qr_barcode_scanner 0.12.2
is available under verified publisher qrcode-ai.com. In a Flutter project, pin
the version explicitly:
flutter pub add qr_barcode_scanner:0.12.2
The package includes the Rust core sources and rust/cargokit.yaml: your
app's build can use a signed precompiled library
when the release has published one, and compiles the core otherwise.
Up to 0.11.0 the package ships no such file and always compiles the core.
To evaluate an upcoming version from this checkout,
follow Packaging from a candidate checkout
below instead. Working source and the published archive are separate candidates.
Toolchain prerequisite. This package compiles the Rust core at your app's build time (via cargokit) — the building machine needs the Rust toolchain (≥1.88) and, for Android, the NDK (r28+). No Rust knowledge required; it's a one-time
rustupinstall. A release that ships signed precompiled libraries lets the app skip this build: see Signed precompiled libraries.NDK r28 aligns the native library for Android devices with 16 KB memory pages. A build with NDK r27 is aligned to 4 KB and does not meet that requirement.
Signed precompiled libraries #
A release that ships rust/cargokit.yaml lets your app skip the Rust build.
Up to 0.11.0 no release ships that file. cargokit, which builds the library
inside your app, first looks for a library precompiled from the exact package
sources, in the engine repository's GitHub release precompiled_<crate hash>.
The crate hash covers the package's Rust sources, its manifest (which records the
bundled core's digest), its lockfile and cargokit.yaml. cargokit downloads
the library and its Ed25519 signature, and uses the library only if the
signature verifies against the public key in rust/cargokit.yaml. If the file
is missing or the signature does not verify, cargokit builds from source,
which needs the toolchain above.
-
On a machine without rustup, cargokit uses the precompiled library by default.
-
With rustup installed, it builds from source unless the app opts in with a
cargokit_options.yamlnext to the app'spubspec.yaml:use_precompiled_binaries: true
The libraries cover Android (armeabi-v7a, arm64-v8a, x86, x86_64) and
iOS (devices, Apple silicon simulators and Intel simulators). They are built
with the release profile, and debug app builds use them too. The dev profile
described in Debug builds and scan time applies
only when cargokit builds from source, and the timings there were measured on
such builds. The signing key never reaches CI: the repository owner signs each
set on their own machine
(RELEASING.md § Flutter precompiled binaries).
Public native consumer evidence #
The public-package consumer run of 12 November 2026
installs the exact pub.dev archive in new applications with an empty package
cache. Android 14 x86_64 passes the mixed QR/Code 128 scans in all three
profiles, blank and invalid input checks, and uninstall. This run explicitly
sets CARGO_PROFILE_DEV_OPT_LEVEL=2 in Flutter debug mode; it does not qualify
default unoptimized debug builds or physical devices. APK alignment passes for
16 KB pages; the emulator itself uses 4 KB pages.
On the iOS simulator, both payloads decode, but the fast profile reports
budgetExhausted == true and fails the unchanged acceptance assertion. Common
iOS acceptance and uninstall are consequently not complete. These are dated
consumer observations, not a comparative benchmark or a claim that every
Android or iOS device is supported. The Flutter API guide
keeps installation, build prerequisites and report-budget semantics together.
Usage #
import 'package:qr_barcode_scanner/qr_barcode_scanner.dart';
await QrcodeAiScanner.init(); // once, before any scan
// Decode + score an encoded image (PNG/JPEG/WebP/GIF):
final report = await QrcodeAiScanner.scan(pngBytes); // profile: 'full' (default)
if (report.detections.isEmpty) {
print('no QR found'); // a result, not an error
} else {
final d = report.detections.first;
print('${d.content.text} • grade ${report.score?.grade.name}');
}
// Decode a raw RGBA camera frame (width*height*4 bytes), no scoring:
final frame = await QrcodeAiScanner.scanFrame(rgba, w, h); // profile: 'frame'
// Set the wall-clock budget in milliseconds (0 = unbounded):
final slow = await QrcodeAiScanner.scan(pngBytes, budgetMs: 10000);
Scans run on flutter_rust_bridge's Rust worker pool, so await never blocks the
UI isolate. Profiles: 'full' (full ladder + score), 'fast' (reduced),
'frame' (per-frame camera decode, no scoring). Errors throw with the
[QRS-xxx] wire code in the message.
Each profile has a default wall-clock budget: full 4000 ms, fast 800 ms,
frame 80 ms. The clock starts once the image is decoded. The optional
budgetMs argument of scan and scanFrame replaces it:
budgetMs |
Budget |
|---|---|
null (omitted) |
the profile's default |
0 |
unbounded, the reproducible mode (not a zero-millisecond budget) |
| 1 to 4294967295 | that many milliseconds |
| above 4294967295 | refused: the scan throws a String ending with [QRS-006] before the image is read |
| negative | refused: RangeError, before the native call |
These are the semantics of budget_ms in the other bindings. Up to 0.11.0 the
package has no budgetMs. When the budget cuts a scan,
the report says so: report.trace.budgetExhausted == true. Empty detections
are then not a final "no QR", and a null score beside a detection means "not
judged", never 0.
The return type ScanReport is fully typed (detections, a
typed Payload sealed class, Score with ISO 15415 / UEC grade cards, hints,
trace, versions). Unknown enum values and payload kinds decode to unknown /
catch-all variants — never a throw (the contract is additively forward-compatible).
Charset and Fnc1Position are the exceptions: a newer wire value decodes to
unrecognized. Charset.unrecognized is a complete reading, while
Charset.unknown is the wire's lossy value — test content.charset.isLossy
and then use content.raw, the payload's bytes.
content.eci and content.fnc1 are null when none was observed or the
symbology does not report it — not proof that the symbol declares none.
Debug builds and scan time #
Simulators and emulators run Flutter only in debug mode. In debug mode,
cargokit builds the Rust core from source with Cargo's dev profile, which the
package sets in rust/Cargo.toml: opt-level 3, no debug assertions, overflow
checks on and no LTO. Incremental builds and codegen units keep Cargo's dev
defaults. Up to 0.11.0 the package has no such table, so its debug builds are
not optimized. A signed precompiled library, when
one is used, is built with the release profile instead.
The budget stops a scan from starting a stage or an attempt once its deadline
has passed. It does not stop one that is running. A scan can therefore take
longer than its budget and still be final (budgetExhausted == false).
Runs of flutter-qualification.yml on 21 November 2026 scanned the mixed
QR/Code 128 fixture under the default budgets (fast 800 ms, frame 80 ms,
full 4000 ms), each profile once, fast first. The values are the report's
trace.totalMs; "cut" means budgetExhausted == true.
| Run | Rust build | Android emulator: fast, frame, full | iPhone simulator: fast, frame, full |
|---|---|---|---|
| 44931609066 | flutter_rust_bridge 2.12.0, this profile, CARGO_INCREMENTAL=0 from the toolchain action |
762 ms cut, 707 ms, 700 ms | 892 ms cut, 782 ms, 776 ms |
| 44934537330 | flutter_rust_bridge 2.13.0, this profile | 849 ms cut, 673 ms, 679 ms | 935 ms cut, 863 ms, 920 ms |
| 44934540185 | flutter_rust_bridge 2.13.0, incremental builds off, 16 codegen units | 604 ms, 425 ms, 441 ms | 1532 ms cut, 175 ms cut, 1321 ms |
| 44940635379 | the same as the row above | 826 ms cut, 683 ms, 705 ms | 1617 ms cut, 2144 ms, 1264 ms |
Incremental builds off with 16 codegen units gave no gain that held. On the Android emulator, the direct stage took about 410 ms in one run and about 670 ms in the next, as without them. Hosted runners differ from run to run, which may explain the difference. The package therefore keeps Cargo's defaults for both.
On the Android emulator, frame and full were final in every run, fast
was cut in three runs of four, and every scan read both codes. The iPhone
simulator varied more, even within one run: in run 44934537330, two frame
scans of the same image with the same build took 863 ms and 2872 ms, and in
run 44940635379 two full scans took 1264 ms and 9760 ms. fast was cut in
every iOS run. In run 44934540185, the first stage of frame alone
took 174 ms, so the 80 ms budget kept the second stage from starting and the
scan read the QR code but not the Code 128.
A second attempt of the iOS job of run 44934537330 built the app, but the test app never connected to the test runner within 40 minutes. The first attempt, with the same build settings, connected. A hang alone therefore does not show that a build setting is at fault.
These are CI observations on shared hosted runners: an Android 14 x86_64 emulator on Ubuntu and an iPhone simulator on macOS 15. They are not device performance, and they do not measure release builds, which use the release profile (thin LTO, one codegen unit).
So in CI the integration tests require only the full default budget to hold.
A fast or frame scan that its default budget cuts prints a
QRSCAN_BUDGET_CUT line and must read nothing outside the fixture. On a
physical device, make the fast and frame budgets a test too:
cd example && flutter test integration_test --dart-define=QRSCAN_STRICT_BUDGETS=true
Packaging from a candidate checkout #
The development binding uses the workspace core by relative path. A pub.dev
package instead bundles the same candidate's sources, from Cargo's normalized
package archive, under rust/vendor/qrcode-barcode-scanner. No published registry
version is substituted. From a clean, committed checkout, with Python 3.11+:
set -o pipefail
python3 scripts/stage-flutter-package.py --output /tmp/scanner-flutter-validation/bindings/flutter \
--archive /tmp/scanner-flutter.tar.gz --receipt /tmp/scanner-flutter.json
git archive HEAD spec/examples | tar -x -C /tmp/scanner-flutter-validation
cd /tmp/scanner-flutter-validation/bindings/flutter
cargo check --locked --manifest-path rust/Cargo.toml --lib
flutter pub get
flutter analyze
test -f ../../spec/examples/clean-url.json
flutter test
Run the inspector from the candidate checkout, pointing it at that same root:
python3 scripts/package-inspect.py flutter --package-root /tmp/scanner-flutter-validation/bindings/flutter \
--strict --release-set --record /tmp/scanner-flutter-inspected.sha256
The output directory must not exist. The staging command runs
cargo package --locked --no-verify (packing only); --core-archive FILE
accepts an already packed candidate and --cargo-wrapper PATH supports isolated
Cargo runners. It verifies the revision, source bytes, versions and LICENSE,
rejects archive links and escaping paths, and preserves the binding lockfile.
Only the staged binding manifest's core path and bundle metadata change.
The metadata includes a deterministic core content digest: cargokit hashes the
binding manifest but does not recursively hash path dependency sources, so a
core-only change must update that manifest. A staged .pubignore preserves the
core's Cargo provenance file in pub's published file set.
CI creates one staged archive, then uses it outside the checkout for the host
checks, Android/iOS example builds and the guarded publishing job. Host contract
tests receive the candidate's canonical JSON goldens outside the package, at
their expected ../../spec/examples path; no adjacent Rust checkout is copied.
Without these fixtures, seven golden tests skip rather than qualify the contract.
The fixtures do not change the staged archive or pub's file set. The inspector
requires pub's parsed file tree and completed validation, checks the bundled
sources recursively, and records the published files' hashes for a final
same-byte check. Validation warnings remain visible; validation errors and an
unparsed listing fail. A missing Flutter/Dart SDK is UNAVAILABLE, not a pass.
Portable source inspection alone does not establish pub.dev readiness: the
real validator and native consumer builds must also pass, and the first upload
and trusted-publisher setup remain operator steps in RELEASING.md.
What it returns #
The picture is a recorded scan of one image that holds a QR code and a Code 128 barcode. Both come back in the same report, each with its format and the place where the engine measured it.
What it reads #
The package holds the engine, so it reads what the engine reads. Codes of different formats in the same image come back in one report.
| Family | Formats |
|---|---|
| QR | QR Code, Micro QR, rectangular Micro QR (rMQR) |
| Matrix and stacked | Data Matrix, Aztec, PDF417, MaxiCode |
| Retail | EAN-13, EAN-8, UPC-A, UPC-E |
| Other linear | Code 128, Code 39, Code 93, Codabar, ITF, GS1 DataBar, GS1 DataBar Expanded, Telepen |
The engine's supported formats section states the known limits.
The same engine in other runtimes #
| Runtime | Package | How it scans |
|---|---|---|
qrcode-barcode-scanner on crates.io |
In process | |
@qrcode-ai-com/qrcode-barcode-scanner on npm |
In process, native | |
@qrcode-ai-com/qrcode-barcode-scanner-wasm on npm |
In the page, WebAssembly | |
qrcode-barcode-scanner on PyPI |
In process | |
qrcode-barcode-scanner-go |
Through the installed qrscan |
|
qrcode-barcode-scanner-php |
Through the installed qrscan |
|
qrscan |
One command, one JSON report |
The Rust, Node.js, browser and Python packages hold the engine. The Go and PHP packages hold no decoder:
each one starts qrscan and hands you its report.
Language and platform names and logos belong to their owners. They identify a runtime or a destination and imply no endorsement.
License #
Project-authored source in this checkout is MIT. See the source license and licensing guide. Published archives and separately licensed dependencies retain their original terms.
Developed by Thibaut Mélen & Nicolas Cella for QR Code AI, a product of SuperNovae Studio. SuperNovae Studio maintains the project and its MIT source distribution.
© SuperNovae Studio.
Source license #
Project-authored scanner code and documentation in this checkout are available under the MIT License. You may use, modify and redistribute this source in open-source or proprietary applications, including commercial products, while preserving the copyright and permission notice. Thibaut Mélen & Nicolas Cella develop QR Code AI at SuperNovae Studio.
Retained third-party code, dependencies, artwork and test data keep their own licenses and notices. The licensing guide explains these component boundaries; the project license does not assign a license to an unrelated platform or service.
Published archives retain the license shipped with their version. A pinned engine, adapter or bundle may therefore have different terms from this working source. Read its packaged license and the license history before reuse. The source change does not replace an archive or publish a new version.







