Flutter plugin for scanning and generating QR codes using the ZXing library, supporting Android, iOS, and desktop platforms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Khoren Markosyan 42706ac85f
Update README.md
3 years ago
.vscode added hive as local database 3 years ago
android added cpp source code files 3 years ago
example fixed barcodes image width 3 years ago
ios code improvements 3 years ago
lib update README.md 3 years ago
test initial commit 3 years ago
.gitignore added cpp source code files 3 years ago
.metadata initial commit 3 years ago
CHANGELOG.md version: 0.1.0 3 years ago
LICENSE updated License file 3 years ago
README.md Update README.md 3 years ago
analysis_options.yaml added cpp source code files 3 years ago
init.sh new zxing-cpp 1.3.0 version update 3 years ago
pubspec.yaml version: 0.1.0 3 years ago

README.md

flutter_zxing

A barcode and QR code scanner based on ZXing C++ library natively in Flutter with Dart FFI.

Demo Screenshots

04_trending_repository_screen  04_trending_repository_screen  04_trending_repository_screen  

Supported Formats

1D product 1D industrial 2D
UPC-A Code 39 QR Code
UPC-E Code 93 DataMatrix
EAN-8 Code 128 Aztec
EAN-13 Codabar PDF417
DataBar ITF MaxiCode (beta)
DataBar Expanded

Getting Started

To read barcode:

import 'package:flutter_zxing/flutter_zxing.dart';

// Use ZxingReaderWidget to quickly read barcode from camera image
@override
Widget build(BuildContext context) {
    return Scaffold(
        body: ZxingReaderWidget(
            onScan: (result) async {
                // Do something with the result
            },
        ),
    ),
);

// Or use FlutterZxing to read barcode from camera image directly
cameraController?.startImageStream((img) async {
    final bytes = await convertImage(img);
    final result = FlutterZxing.readBarcode(bytes, Format.Any, img.width, img.height, 200, 200);
    if (result.isValidBool) {
        debugPrint(result.textString);
    }
    return null;
});

To create barcode:

import 'package:flutter_zxing/flutter_zxing.dart';
import 'dart:typed_data';
import 'package:image/image.dart' as imglib;

// Use ZxingWriterWidget to quickly read barcode from camera image
@override
Widget build(BuildContext context) {
    return Scaffold(
        body: ZxingWriterWidget(
            onSuccess: (result, bytes) {
                // Do something with the result
            },
            onError: (error) {
                // Do something with the error
            },
        ),
    ),
);

// Or use FlutterZxing to create barcode directly
final text = 'Text to encode';
final result = FlutterZxing.encodeBarcode(text, 300, 300, Format.Any, 10, 0);
if (result.isValidBool) {
    final img = imglib.Image.fromBytes(width, height, result.bytes);
    final encodedBytes = Uint8List.fromList(imglib.encodeJpg(img));
    // use encodedBytes as you wish
}

License

MIT License. See LICENSE.