scan_tally_mobile_scanner
Camera adapter that connects mobile_scanner to scan_tally. With it, a camera counts items the way a stock count needs:
- each item counts once while it stays in view;
- it counts again after it leaves the view and comes back (or after a cooldown);
- blurry misreads are filtered by N-frame confirmation;
- you get undo, a validator, GS1 parsing and feedback from
scan_tally.
Installation
dependencies:
scan_tally: ^0.1.0
scan_tally_mobile_scanner: ^0.1.0
mobile_scanner: ^7.3.0
Follow the platform setup of mobile_scanner (camera permission text on iOS/macOS).
Usage
import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:scan_tally/scan_tally_flutter.dart';
import 'package:scan_tally_mobile_scanner/scan_tally_mobile_scanner.dart';
final controller = MobileScannerSource.createController();
final session = ScanSession(
dedupe: const DedupePolicy.leaveAndReturn(),
confirmation: const FrameConfirmation(frames: 2),
feedbackPlayer: const FlutterScanFeedbackPlayer(),
);
session.attach(MobileScannerSource(controller));
// build:
ScanFlash(session: session, child: MobileScanner(controller: controller));
createController() returns a controller with DetectionSpeed.normal and a detection timeout of 150 ms, so a code in view is reported about every 150 ms.
Do not use DetectionSpeed.noDuplicates. It hides the repeated reads that scan_tally needs to know a code is still in view, so leave-and-return counting and frame confirmation stop working.
If you already use MobileScanner(onDetect: ...), feed the captures to MobileScannerSource.fromCaptures(stream) instead.
Each BarcodeCapture becomes one continuous ScanFrame. BarcodeFormat is mapped to ScanSymbology, so EAN/UPC codes get check-digit validation. Errors on the controller stream are skipped.
Compatibility
| scan_tally_mobile_scanner | mobile_scanner | scan_tally | Flutter |
|---|---|---|---|
| 0.1.x | >=7.3.0 <8.0.0 (developed with 7.4.2, analyzed and tested against 7.3.0) |
^0.1.0 | ≥ 3.32 |
mobile_scanner 7.0–7.2 lack some BarcodeFormat values this adapter maps, so 7.3.0 is the lower bound. A new major version of mobile_scanner gets a new adapter release after testing.
Why a separate package?
- The core
scan_tallyhas no camera dependency. Apps that only use hardware (keyboard wedge) scanners do not ship a camera plugin, ML Kit or the camera permission. - Camera plugin API changes only touch this small adapter.
- To connect another scanner plugin, implement
ScanSource(aStream<ScanFrame>) the same way; seemobile_scanner_source.dart.
Status
Compiled and unit tested with simulated captures. In this release it has not yet been tried on a physical device.
Other packages
More packages by the same author:
google_maps_polyline: Google Directions routes and polyline encode/decode (pure Dart)marker_crafter: Custom Google Maps markers drawn with Canvasanimated_route_marker: Smoothly animated map marker along a route or live GPSadvanced_background_locator: Background location tracking plugin (Android/iOS)advanced_geofence: Pure Dart geofencing engine: enter, exit and dwell eventsroute_simulator: Realistic fake GPS streams for testing and demosbackground_doctor: Diagnoses why background work stops on Android and why the app was killedscan_tally: Continuous barcode scanning for stock counts: dedupe, tally, feedback, GS1turkish_kit: Turkish validators, money in words, casing, provinces, holidays (pure Dart)turkish_kit_flutter: Flutter widgets for turkish_kit: Turkish money field and input formattersflutter_toastify: Animated toast notifications
License
MIT
Türkçe
mobile_scanner paketini scan_tally'ye bağlayan ince kamera adaptörü. Kamerayla stok sayımına uygun şekilde sayım yapılır:
- her ürün görüntüde kaldığı sürece bir kez sayılır;
- görüntüden çıkıp geri gelince (ya da bekleme süresi dolunca) yeniden sayılır;
- bulanık görüntüden gelen yanlış okumalar art arda N kare şartıyla ayıklanır;
- geri alma, doğrulama, GS1 çözümleme ve geri bildirim
scan_tally'den gelir.
Kullanım
Kod örneği yukarıdaki İngilizce bölümdedir.
MobileScannerSource.createController()önerilen ayarlarla bir denetleyici döndürür:DetectionSpeed.normalve 150 ms algılama aralığı.DetectionSpeed.noDuplicateskullanmayın. Bu mod, kodun hâlâ görüntüde olduğunu anlamak için gereken tekrar okumaları gizler.MobileScanner(onDetect: ...)kullanıyorsanız yakalamalarıMobileScannerSource.fromCaptures(stream)ile verin.
Uyumluluk
- scan_tally_mobile_scanner 0.1.x, mobile_scanner
>=7.3.0 <8.0.0ile çalışır.- 7.4.2 ile geliştirildi; 7.3.0'a karşı analiz edildi ve test edildi.
- 7.0–7.2'de bu adaptörün eşlediği bazı
BarcodeFormatdeğerleri yok.
- Yeni bir ana
mobile_scannersürümü, test edildikten sonra yeni bir adaptör sürümüyle desteklenir.
Neden ayrı paket?
- Çekirdek paketin kamera bağımlılığı yoktur. Yalnızca el terminali kullanan bir uygulama kamera eklentisi, ML Kit ve kamera izni taşımaz.
- Kamera eklentisindeki API değişiklikleri yalnızca bu küçük adaptörü etkiler.
- Başka bir tarayıcı paketini bağlamak için
ScanSourcearayüzünü aynı şekilde uygulayın.
Durum
Derlendi ve benzetilmiş yakalamalarla birim testlerinden geçti. Bu sürümde fiziksel cihazda henüz denenmedi.
Diğer paketler
Aynı geliştiricinin diğer paketleri:
google_maps_polyline: Google Directions rotası ve polyline kodlama/çözme (saf Dart)marker_crafter: Canvas ile çizilen özel Google Maps işaretçilerianimated_route_marker: Rota ya da canlı GPS üzerinde akıcı hareket eden harita işaretçisiadvanced_background_locator: Arka planda konum takibi eklentisi (Android/iOS)advanced_geofence: Saf Dart geofence motoru: giriş, çıkış ve bekleme olaylarıroute_simulator: Test ve demo için gerçekçi sahte GPS akışıbackground_doctor: Android'de arka plan işinin neden durduğunu ve uygulamanın neden kapandığını teşhis ederscan_tally: Stok sayımı için sürekli barkod okutma: tekrar ayıklama, sayım, geri bildirim, GS1turkish_kit: Türkçe doğrulayıcılar, tutarı yazıyla yazma, harf dönüşümü, il/ilçe, tatiller (saf Dart)turkish_kit_flutter: turkish_kit için Flutter bileşenleri: Türk biçimli para alanı ve girdi biçimleyicileriflutter_toastify: Animasyonlu toast bildirimleri
Lisans
MIT
Libraries
- scan_tally_mobile_scanner
- Connects mobile_scanner to scan_tally.