पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

GitHub रिपॉज़िटरीxvrh/zxing-dart

zxing-dart

यह पैकेज ZXing ("ज़ीब्रा क्रॉसिंग") जावा लाइब्रेरी का शुद्ध डार्ट पोर्ट है।

zxing-dart प्रोजेक्ट कवर
स्टार
31
फ़ोर्क
14
अंतिम पुश (UTC)
6 जून 2025
प्रोजेक्ट स्थिति
सक्रिय

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

zxing-dart

ZXing ("zebra crossing") is an open-source, multi-format 1D/2D barcode image processing library.
This package is a pure Dart port of the original Java library.

For now, it only supports QR-Code (encoding and decoding). New format can easily be added if this port proves useful.

pub package Build Status codecov

Buy Me A Coffee

Getting started

QR Code
Decoding

The QRCodeReader class takes a list of bytes and returns the decoded barcode.

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.abgr)
          .buffer
          .asInt32List());
  var bitmap = BinaryBitmap(GlobalHistogramBinarizer(source));

  var reader = QRCodeReader();
  var result = reader.decode(bitmap);
  print(result.text);
}
Encoding

The QRCodeReader class takes a list of bytes and returns the decoded barcode.

import 'dart:io';
import 'package:image/image.dart' as img;
import 'package:zxing2/qrcode.dart';

void main() {
  var qrcode = Encoder.encode('ABCDEF', ErrorCorrectionLevel.h);
  var matrix = qrcode.matrix!;
  var scale = 4;

  var image = img.Image(
      width: matrix.width * scale,
      height: matrix.height * scale,
      numChannels: 4);
  for (var x = 0; x < matrix.width; x++) {
    for (var y = 0; y < matrix.height; y++) {
      if (matrix.get(x, y) == 1) {
        img.fillRect(image,
            x1: x * scale,
            y1: y * scale,
            x2: x * scale + scale,
            y2: y * scale + scale,
            color: img.ColorRgba8(0, 0, 0, 0xFF));
      }
    }
  }
  var pngBytes = img.encodePng(image);
  File('tool/examples/encoded.png').writeAsBytes(pngBytes);
}

Flutter

The example folder contains a full example that uses the official camera plugin connected to this package to decode barcode from the bytes stream.

Xavier H. GitHub avatar
GitHub लेखक

Xavier H. ↗

Web & mobile developer

FreelanceBelgium
भाषाएँDart

श्रेणियाँ

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 12 आइटम

  • charcode^1.2.0
  • collection^1.15.0
  • fixnum^1.0.0
  • meta^1.3.0
  • dart_styleडेवलपमेंट—
  • imageडेवलपमेंट—
  • lintsडेवलपमेंट—
  • pathडेवलपमेंट—
  • project_toolsडेवलपमेंट{"git":{"url":"https://github.com/xvrh/project_tools.dart.git"}}
  • pub_semverडेवलपमेंट—
  • testडेवलपमेंट—
  • yamlडेवलपमेंट—

अपने प्रोजेक्ट के लिए रिपॉज़िटरी कैसे चुनें?

उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।

  1. नाम, लेखक या विवरण से खोजें और तकनीकी विषय से परिणाम सीमित करें।
  2. स्टार, फ़ोर्क और हाल के पुश की तुलना करें। स्टार रुचि दर्शाते हैं, गुणवत्ता की गारंटी नहीं।
  3. उपयोग से पहले GitHub पर README, लाइसेंस और Issues जाँचें।

स्रोत और रखरखाव

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗