juliansteenbakker/mobile_scanner
A universal Flutter barcode and QR code scanner using CameraX/ML Kit for Android, AVFoundation/Apple Vision for iOS & macOS, and ZXing for web.
What it solves
mobile_scanner is a Flutter plugin that lets app developers add barcode and QR-code scanning to their mobile and web apps using the device's camera. It handles the hard parts of camera access, real-time frame processing, and decoding, so developers don't have to write platform-specific code for Android, iOS, macOS, or the web.
How it works
The plugin wraps native barcode-detection libraries on each platform: MLKit on Android, Apple's Vision framework on iOS and macOS, and a choice of browser-based backends on the web (the browser's built-in BarcodeDetector API, a WebAssembly port of ZXing called zxing-wasm, or a legacy pure-JavaScript ZXing library).
Developers use a MobileScanner widget with an onDetect callback that fires whenever a barcode is recognized. For more control, a MobileScannerController exposes options like camera resolution, detection speed, which barcode formats to look for, torch (flashlight) control, image inversion, auto-zoom, and the ability to switch between camera lenses (normal, wide, zoom). It also provides helpers to query which lenses a device has and to pick the lens that can focus closest for close-range scanning.
Who it's for
Flutter developers building apps that need to scan QR codes or barcodes — for example, ticketing, payments, inventory, loyalty programs, or authentication flows. It's a drop-in package rather than a standalone application.
Highlights
- Cross-platform: Android, iOS, macOS, and web (no Linux or Windows support).
- Real-time detection with support for many barcode formats (QR, Code 128, EAN, DataMatrix, PDF417, Aztec, and more).
- Configurable scanning: scan window, auto-zoom, torch, detection speed, and format filtering.
- Lens-type switching and a helper to pick the best lens for close-range scanning.
- Web implementation offers three detection backends with a performance/format trade-off, plus a configurable CDN mirror for the scanning library.
- On Android, developers can choose between a bundled MLKit model (larger app, works immediately) or an unbundled one downloaded via Google Play Services (smaller app).
Related
- Project
- Project
- Project
- Project
- Project