Skip to content
pubscout

zxing2

0.2.4, released a year ago by xaha.dev

Pure Dart library for encoding and decoding QR codes.

WASM-ready
$ flutter pub add zxing2
Source repository

What it does

Provides QR‑code encoding and decoding using only Dart code. Works with image byte data and returns text results. Currently limited to QR format only.

AI-written summary of version 0.2.4, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need QR‑code generation or reading in a pure‑Dart/Flutter project without native plugins.
  • You target multiple platforms (mobile, web, desktop) and want a single dependency.

Skip it when

  • You require other barcode formats (EAN, Code128, etc.).
  • You need high‑performance real‑time scanning from a camera stream.

Strengths

  • Pure Dart – no native setup or permissions required.
  • Supports both encoding and decoding of QR codes.
  • Works on all Dart‑supported platforms.

Weaknesses

  • Only QR‑code format is supported.
  • Performance may be lower than native scanner libraries.
  • No built‑in camera UI – you must integrate a camera plugin yourself.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4
import 'dart:io';
import 'package:image/image.dart' as img;
import 'package:zxing2/qrcode.dart';

void main() {
  var image = img.decodePng(File('example.png').readAsBytesSync())!;
  var source = RGBLuminanceSource(image.width, image.height,
      image.convert(numChannels: 4).getBytes(order: img.ChannelOrder.abgr).buffer.asInt32List());
  var bitmap = BinaryBitmap(GlobalHistogramBinarizer(source));
  var result = QRCodeReader().decode(bitmap);
  print(result.text);
}

Alternatives

Packages that do the same job and could replace zxing2.

Works with

Packages commonly used together with zxing2: ones it builds on, ones built on it, and its own family.