mobile_scanner
A Flutter barcode and QR scanner for Android, iOS, macOS, and web.

About
mobile_scanner is a Flutter barcode scanner for apps that need fast camera-based QR and barcode reading. It uses CameraX and ML Kit on Android, AVFoundation and Apple Vision on iOS and macOS, and ZXing on the web. The package is built for real-time detection, multiple barcode formats, and camera behavior that can be tuned for different scanning flows.
What is mobile_scanner
mobile_scanner is a Flutter barcode scanner package that lets you read QR codes and other barcode formats from a device camera. It is designed as a lightweight plugin for cross-platform apps and is published on pub.dev as version 7.4.0. The package supports Android, iOS, macOS, and web, with no Linux or Windows support listed in the source material.
The implementation uses platform-specific scanning stacks: CameraX and ML Kit on Android, AVFoundation and Apple Vision on iOS and macOS, and ZXing on the web. That split matters because the scanning experience and available camera controls can differ by platform.
Key features
- Fast camera-based scanning for barcodes and QR codes.
- Support for multiple barcode formats rather than a single code type.
- Real-time detection so codes can be recognized as the camera feed updates.
- Customizable scanner behavior for apps that need a tighter scan area or different camera handling.
- Image analysis support on Android, iOS, and macOS.
- Optional image return support on Android, iOS, and macOS.
- Scan window support on Android, iOS, and macOS.
- Auto zoom support on Android only.
- Lens-type querying on Android and iOS, with facing filters for back or front cameras.
- Close-range lens selection helpers for devices that expose the right camera data.
Platform support is not identical across devices. For example, analyzeImage, returnImage, and scanWindow are not available on the web according to the package feature table. Lens controls are also more limited on macOS and web than on mobile.
How to use it
- Add the package to your Flutter project through pub.dev and import it in your app.
- Place the scanner widget or controller-driven scanner flow in the screen where you want to capture codes.
- Configure the camera behavior you need, such as a scan window, lens facing, or image-return settings.
- Listen for detection events so your app can react when a barcode or QR code is found.
- If your app supports switching cameras, query supported lenses first so you only select hardware the device actually exposes.
A few of the package helpers are meant to make camera selection safer:
getSupportedLenses()returns the lens types available on the device.- Passing a
facingfilter narrows that list to one side of the camera hardware on Android and iOS. getBestCloseRangeScanningLens()helps choose the lens that focuses closest, which can be useful for small codes held near the camera.
The source also shows that some examples exist in the package documentation, including basic usage, scan windows, and retrieving images from detected barcodes.
Who it is for
mobile_scanner is a good fit for Flutter developers building apps that need barcode reading without writing native scanner code from scratch. Typical uses include:
- inventory and asset tracking apps
- ticketing and check-in flows
- retail or product lookup tools
- internal utility apps that need QR code capture
- apps that need a custom scan zone or live detection feedback
It is also relevant for developers who want one plugin that covers mobile and web, while still exposing platform-specific controls where they exist.
What to know before you use it
The package does not support Linux or Windows in the source data, so desktop coverage is limited to macOS only. Some features are platform-specific, and the web version has fewer camera and image-analysis capabilities than Android and iOS.
A few caveats are important:
autoZoomis supported on Android only.analyzeImage,returnImage, andscanWindoware not available on web.- On macOS and web, lens-type facing filters are ignored and all lenses may be returned.
getBestCloseRangeScanningLens()can returnnullif no camera is available for the requested facing direction.- The returned best lens is not guaranteed to be selectable, so you should confirm it against
getSupportedLenses()before switching.
For device-specific availability, camera permissions, and platform quirks, your app should still rely on runtime checks and the official Flutter plugin documentation. The package gives you scanner building blocks, but it does not replace platform policy, permission handling, or hardware validation.
For teams that need a Flutter barcode scanner with cross-platform reach and configurable camera behavior, mobile_scanner is a practical starting point. If you need the most accurate feature details for a given device or OS version, verify them in the package docs and the official camera APIs before shipping.
FAQ
Is mobile_scanner free to use?
Yes, it is distributed as an open-source Flutter package on pub.dev. The source material does not list paid tiers or licensing add-ons.
Which platforms does mobile_scanner support?
It supports Android, iOS, macOS, and web. Linux and Windows are shown as unsupported in the package feature table.
Does mobile_scanner work with QR codes only?
No, it supports QR codes and multiple barcode formats. The package description calls out barcode scanning generally, not just QR reading.
Can I scan QR codes and barcodes in real time?
Yes, the plugin is built for real-time detection of barcodes and QR codes from the device camera. It also supports multiple barcode formats, which makes it useful for mixed scanning workflows.
Can I use mobile_scanner for both QR codes and barcodes?
Yes, it is built for both QR and other barcode formats. The package description explicitly calls out multiple barcode formats and real-time detection.
Can I use mobile_scanner for QR codes and barcodes?
Yes, it is built for both QR code and barcode scanning. The package description also says it supports multiple barcode formats.
Can I control the scanner window or camera behavior?
Yes, the docs mention customization options and examples for scan windows and camera behavior. Some controls are platform-limited, so you should check the support matrix before building around them.
Does mobile_scanner work on the web?
Yes, web support is documented and uses ZXing. Some features are unavailable on web, including `analyzeImage`, `returnImage`, `scanWindow`, `autoZoom`, and lens-type controls.
How do I choose the best camera lens for close-up scanning?
Use `getBestCloseRangeScanningLens()` and verify the result with `getSupportedLenses()` before switching. The helper is designed to find the lens that can focus closest to the phone.
Does mobile_scanner work with Flutter on the web?
Yes, it supports Flutter web through ZXing. Some features such as analyzeImage, returnImage, and scanWindow are not available on web.
Can I customize the scanning area?
Yes, the package supports a scan window on Android, iOS, and macOS. That makes it useful when you want a smaller target area than the full camera feed.
Who should use mobile_scanner?
Flutter developers building camera-based scanning flows should use it. It is a good fit for check-in, inventory, retail, logistics, and QR login use cases.
When should I use getBestCloseRangeScanningLens()?
Use it when you need better close-up scanning on supported devices. The package recommends checking the result against `getSupportedLenses()` before switching cameras because the best lens may not always be selectable.
How do I choose the best camera lens for close-up scans?
Use getBestCloseRangeScanningLens() together with getSupportedLenses() before switching cameras. The package notes that this is especially useful for close-range barcode reading, but support varies by platform.
What should I check before switching cameras?
You should check supported lenses first with `getSupportedLenses()`. The docs note that the returned best lens is not guaranteed to be selectable unless it is also reported as supported.