zxing2 0.2.3 zxing2: ^0.2.3 copied to clipboard
A multi-format 1D/2D barcode image processing library implemented in Dart. This is a port of the Android library.
import 'dart:io';
import 'package:image/image.dart' as img;
import 'package:zxing2/qrcode.dart';
void main() {
var image = img.decodePng(File('tool/example.png').readAsBytesSync())!;
LuminanceSource source = RGBLuminanceSource(
image.width,
image.height,
image
.convert(numChannels: 4)
.getBytes(order: img.ChannelOrder.rgba)
.buffer
.asInt32List());
var bitmap = BinaryBitmap(HybridBinarizer(source));
var reader = QRCodeReader();
var result = reader.decode(bitmap);
print(result.text);
}