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

flutter_qr_reader 封面
插件详情v1.0.5

flutter_qr_reader

二维码(扫描二维码和图片)识别(AndroidView/UiKitView)

AndroidiOS
近 30 天下载
1.2万
喜欢数
80
Pub 分数
125

安装插件

flutter pub add flutter_qr_reader

插件介绍

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

一个用于从图像中扫描和读取二维码的Flutter包,支持实时摄像头扫描和基于图像的识别。它利用平台视图(AndroidView/UiKitView)在Android和iOS上集成原生扫描功能。适用于需要快速从二维码提取数据的应用程序,例如支付系统、票务或库存跟踪。该包轻量级,设计为可轻松集成,配置最少。

适合场景

  • 应用中的实时二维码扫描
  • 从保存的图像中读取二维码
  • 支付和票务验证系统
  • 库存和资产追踪
  • 通过二维码进行用户身份验证
  • 数据录入自动化

主要特点

  • 支持实时摄像头扫描
  • 基于图像的二维码识别
  • 原生平台视图集成
  • 跨平台兼容性(iOS 和 Android)
  • 简单的 API 用于集成
  • 代码检测的高精度

适合对象

  • 需要二维码扫描的移动应用
  • 电子商务和零售应用
  • 活动票务平台
  • 物流和供应链工具
  • 开发条形码解决方案的开发团队

使用建议

  • 需要移动设备上的相机权限
  • 可能需要为iOS相机访问进行额外设置
  • 性能取决于设备硬件
  • 仅限二维码类型(不包括其他条形码)
  • 背景扫描不受支持
  • 图像质量影响识别成功率

原始 README

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

flutter_qr_reader

QR code (scan code / picture) recognition (AndroidView/UiKitView)

DEMO

demo

demo

Getting Started

import 'package:flutter_qr_reader/flutter_qr_reader.dart';

// 识别图片
final String data = await FlutterQrReader.imgScan(File);

// 嵌入视图
QrReaderView(
  width: 320,
  height: 350,
  callback: (container) {},
)
// 打开手电筒
..setFlashlight
// 开始扫码
..startCamera
// 结束扫码
..stopCamera
For IOS

Opt-in to the embedded views preview by adding a boolean property to the app's Info.plist file with the key io.flutter.embedded_views_preview and the value YES.

<key>io.flutter.embedded_views_preview</key>
<string>YES</string>

And you will need provide the description of camera's permission to work properly, otherwise will crash your app.

  <key>NSCameraUsageDescription</key>
	<string>The porpuse explaining why you will use the camera</string>

Built-in UI

Widget build(BuildContext context) {
    return new Scaffold(
      body: QrcodeReaderView(key: qrViewKey, onScan: onScan),
    );
}

GlobalKey<QrcodeReaderViewState> qrViewKey = GlobalKey();

Future onScan(String data) async {
    await showCupertinoDialog(
      context: context,
      builder: (context) {
        return CupertinoAlertDialog(
          title: Text("扫码结果"),
          content: Text(data),
          actions: <Widget>[
            CupertinoDialogAction(
              child: Text("确认"),
              onPressed: () => Navigator.pop(context),
            )
          ],
        );
      },
    );
    qrViewKey.currentState.startScan();
}

所属分类

源码仓库

使用此插件的项目