搜尋套件、儲存庫與 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.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。