Skip to main content

flutter_zxing 4.0.0 copy "flutter_zxing: ^4.0.0" to clipboard
flutter_zxing: ^4.0.0 copied to clipboard

Scan 32 barcode formats and create 30, QR codes included, on Android, iOS, macOS, Linux, Windows and the web with zxing-cpp. No ML Kit, no Play services.

flutter_zxing #

Scan and create QR codes and barcodes in Flutter.
32 formats on Android, iOS, macOS, Linux, Windows and the web, a ready-made scanner you can brand, and styled codes to show, export and print.
Powered by zxing-cpp: no ML Kit, no Google Play services, no network.

pub version pub likes pub points CI License: MIT

Documentation Live demo Templates API reference

Scanning with a scan line Several codes labelled in view Check-in template with an accepted ticket Boarding pass read and shown A styled Wi‑Fi QR code made in the app A sheet of numbered labels to print

Features #

  • A complete scanner in one line. 16 ready-made templates (payments, tickets, check-in, retail, pharma, logistics, kiosk…) with a result sheet, or just the camera and your own UI.
  • Your brand's look. Accent, scan window, scan line, glass, buttons, icons and text styles; texts in English, Russian, German, Spanish, French and Chinese, following the app's language.
  • 32 formats to read, 30 to create, the same on every platform, including Micro QR, rMQR, DataBar, MaxiCode and MicroPDF417, which ML Kit does not read.
  • Knows what is inside. URLs, Wi‑Fi, contacts, events, payments (SEPA, Swiss QR-bill, UPI, PIX…), GS1, boarding passes, driver's licenses and more, as Dart types; and builds them back into codes.
  • Barcodes as widgets. Sharp at any size, with colors, gradients, rounded or dot modules and a logo; exported to PNG and SVG, or laid out on label sheets as PDF.
  • Private and fast. Everything runs on the device, off the UI thread, in WebAssembly on the web. Every camera frame is decoded in 2–4 ms.

Soft style Dots style Lagoon style Night style QR code with a logo QR code on a card with a caption

Quick start #

flutter pub add flutter_zxing
import 'package:flutter_zxing/scanner.dart';

// Scan one code and come back with it (null if the user closes the scanner).
final Barcode? barcode = await scanBarcode(context);

// A scanner screen in your own page: camera, buttons, hints and a result sheet.
BarcodeScanner(
  template: const ScannerTemplate.minimal(),
  onDetect: (capture) => print(capture.barcode.text),
)

// A QR code.
const BarcodeView('https://pub.dev/packages/flutter_zxing', width: 200)

scanner.dart is the whole 4.0 API; flutter_zxing.dart adds the deprecated 3.x API. No CMake, CocoaPods or Gradle setup: a build hook compiles the engine. Requires Flutter 3.41 or newer. Add the camera permission on iOS and Android, and see Platforms for the web and desktop.

Documentation #

Scanning Scan one code · Templates · Colours and texts · Your own UI · The controller
Images Read an image · Reader options
Creating Barcodes as widgets · Styles and logos · PNG and SVG · Label sheets · Many codes
Content What is in a code · Payments · Building content
Recipes Use cases: 26 screens to copy, from tickets at the door to a Wi‑Fi card for guests
Reference Formats · Accuracy and speed · API reference

Platforms #

Android iOS Web macOS Linux Windows
Read images and create codes ✅ ✅ ✅ ✅ ✅ ✅
Camera scanner ✅ ✅ ✅ ✅ ᶜ ✅ ᶜ ✅ ᶜ

ᶜ with camera_desktop. The web runs the same engine as WebAssembly in a Web Worker, in Chrome, Safari and Firefox.

Performance #

  • Every camera frame decoded: 30 per second on an iPhone 17 Pro Max, 25 on a Pixel 4a (2020), no frame skipped and no UI frame late.
  • A 12-megapixel photo with a small QR code is read in about 0.1 s on a MacBook and 0.2 s on a Pixel 4a, without blocking the UI.
  • Small: +2.7 MB per Android ABI, +1.0 MB on iOS, 312 KB on the web.

All numbers and how they were measured: Accuracy and speed.

Why flutter_zxing #

Choose it when Google services, offline use or privacy matter, when you need formats ML Kit does not read, Linux or Windows, the same results on every platform, or scanning and generation in one package. Machine-learning scanners such as mobile_scanner read damaged and far-away codes better; the honest comparison covers both sides and maps its API to ours.

Upgrading from 3.x #

The 3.x API keeps working in 4.x on the new engine, deprecated until 5.0; each deprecated name points to its replacement. See Upgrading from 3.x and the CHANGELOG.

Contributing #

Bug reports, ideas and pull requests are welcome. See CONTRIBUTING.md to build the package and run the demo and the tests.

License #

MIT, see LICENSE. zxing-cpp is licensed under Apache 2.0.

150
likes
160
points
76.5k
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Scan 32 barcode formats and create 30, QR codes included, on Android, iOS, macOS, Linux, Windows and the web with zxing-cpp. No ML Kit, no Play services.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#barcode #qrcode #scanner #camera #zxing

License

MIT (license)

Dependencies

camera, camera_platform_interface, code_assets, ffi, flutter, hooks, image, image_picker, intl, logging, native_toolchain_c, web

More

Packages that depend on flutter_zxing