搜索插件、代码仓与 APP 分类

插件详情v4.0.1

qr

一个用于 Dart 的二维码生成库。支持版本 1 到 40 的二维码,错误校正和冗余。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
489万
喜欢数
265
Pub 分数
160

安装插件

flutter pub add qr

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

qr 包是一个用于生成二维码的 Dart 库,支持版本 1 到 40,并可自定义错误校正级别。它使开发者能够创建可扩展、可靠的二维码,适用于各种应用场景。该库轻量且兼容所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。它提供了简单的 API,用于将文本、URL 和其他数据编码为二维码图像。非常适合需要生成条形码而无需外部依赖的应用。

适合场景

  • 生成网址的二维码
  • 创建产品或票证标识符
  • 通过二维码启用联系人共享
  • 支持离线数据传输
  • 促进应用链接
  • 在可打印材料中嵌入信息

主要特点

  • 支持QR版本1–40
  • 多重错误校正级别
  • 跨平台兼容性
  • 用于编码数据的简单 API
  • 高度可定制的输出
  • 轻便高效

适合对象

  • 移动应用开发者
  • Web 应用程序创建者
  • 桌面应用程序构建工具
  • 库存或票务系统
  • 营销和活动应用
  • 教育工具

使用建议

  • 需要手动处理图像渲染
  • 无内置 UI 组件
  • 错误校正会影响大小和可读性
  • 仅限二维码生成
  • 未包含解码功能
  • 输出格式取决于外部渲染

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

A QR code generation package for Dart.

Pub Package package publisher CI

Features

  • Supports QR code versions 1 - 40
  • Error correction / redundancy
  • ECI (Extended Channel Interpretation) support

Demo

A rich, HTML demo can be found at: qr.kevmoo.com.

QR Code Generator Demo

Getting started

To start, import the dependency in your code:

import 'package:qr/qr.dart';

To build your QR code data you should do so as such:

final qrCode = QrCode(
  payload: QrPayload.fromString('Hello, world in QR form!'),
  errorCorrectLevel: QrErrorCorrectLevel.low,
);
final qrImage = QrImage(qrCode);

To enable Extended Channel Interpretation (ECI) mode or build multi-part data, you can use QrPayload:

final payload = QrPayload()
  ..addECI(QrEciValue.utf8)
  ..addString('Hello, world in QR form!');

final qrCode = QrCode(
  payload: payload,
  errorCorrectLevel: QrErrorCorrectLevel.low,
);

Now you can use your qrImage instance to render a graphical representation of the QR code. A basic implementation would be as such:

for (var x = 0; x < qrImage.moduleCount; x++) {
  for (var y = 0; y < qrImage.moduleCount; y++) {
    if (qrImage.isDark(y, x)) {
      // render a dark square on the canvas
    }
  }
}

See the example directory for further details.

Packages that use package:qr

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

所在榜单