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

插件详情v0.1.4

flutter_barcode_listener

无需任何制造商 SDK 即可监听任何硬件条形码扫描仪

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1.8万
喜欢数
183
Pub 分数
150

安装插件

flutter pub add flutter_barcode_listener

插件介绍

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

Flutter Barcode Listener 是一个跨平台包,可让应用程序接收任何硬件条形码扫描仪的输入,而无需使用制造商特定的 SDK。它通过检测标准输入事件,在 Android、iOS、Web、macOS、Windows 和 Linux 上无缝工作。该包抽象了硬件集成的复杂性,使在零售、库存管理、物流和销售点系统中实现条形码扫描功能变得简单。开发者可以专注于业务逻辑,而不是设备特定的配置。

适合场景

  • 零售库存跟踪
  • 销售点系统
  • 物流和运输
  • 资产管理
  • 移动数据录入
  • 仓库运营

主要特点

  • 跨平台支持
  • 无需制造商 SDK
  • 自动输入检测
  • 简单的事件驱动API
  • 适用于任何USB/蓝牙条形码扫描仪
  • 实时扫描响应

适合对象

  • 开发POS应用的开发者
  • 库存管理解决方案
  • 现场服务应用程序
  • 电子商务移动工具
  • 企业数据采集系统

使用建议

  • 需要物理条形码扫描硬件
  • 某些平台可能需要权限处理
  • 仅限文本格式的条形码
  • 不适用于基于相机的扫描
  • 依赖于系统级输入识别
  • Web 支持可能因浏览器而异

原始 README

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

flutter_barcode_listener

Listen for any hardware barcode scanner

Problems with barcode scanning

If you need to get barcode scanned from some hardware barcode scanner you generally have few ways to do it.

  1. implement some text input control (IE. TextEdit), call focus on it and make the scan
  2. listen for some special system event (IE. intent fired from Android service)
  3. listen for raw keyboard events

First aproach is simple, and if you're ok to catch scanned barcodes only when you have focus on text control you're good to go and you don't need this package.

If you however need to somehow get scanned barcodes even when you don't have focus on text input control (or no text input control at all) you're left with two other options.

Listening for special system events (IE. Anroid service intents) is always tied for specific manufacturer/device that usually comes with some kind of SDK you need to implement. This means you're implementation will support listening barcode scannes only for this devices you implemented. Plus, it's not really cross platform friendly

And there's third way, simply listen for raw keyboard events and figure out what's barcode and what's not. Downside of this solution is that you need to figure out what's actual user interaction and what's barcode scan. Upside is it doesn't require any per manufacturer/device implementation and you're pretty much suporting all barcode scanners, including external ones with bluetooth or wifi. And it's cross platform friendly.

Implementation idea

All hardware barcode devices have few things in common

  • they act as a keyboard when barcode is scanned
  • all keyboard events are fired in extremly small time frame (less than 100 ms between each character)
  • barcode is terminated with special character (enter in majority)

So to figure out what is actual barcode and what is simple keyboard event that should be ignored this package uses following logic

  1. listen for physical keyboard raw key up event
  2. filter out only 'REAL' characters (ASCII codes lower than 256, without special characters except enter)
  3. on each new key check if previous key is older than bufferDuration, if it's older clear internal buffer.
  4. check if new key is enter key, if it is call onBarcodeScanned callback and clear buffer
  5. if it's not enter key just append it to internal buffer;

Basically it translates to: if you get bunch of keys comming really fast that end with enter key it's a BINGO.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。