weebi_barcode_scanner 1.7.3 copy "weebi_barcode_scanner: ^1.7.3" to clipboard
weebi_barcode_scanner: ^1.7.3 copied to clipboard

PlatformmacOSWindows
unlisted

Self-contained barcode scanner with real-time detection overlay. Features embedded YOLO detection, cross-platform support (Windows/macOS), point-of-sale optimizations, and OpenFoodFacts integration. N [...]

Weebi Barcode Scanner #

A Flutter package for barcode scanning (1D & 2D) on laptop (Windows and MacOS) powered by YOLO object detection and ZXing decoding.

This package provides unprecedented free support for windows barcode scanning. The only free alternative in 2025 only handles QR code through a webview simple_barcode_scanner.

Thanks to computer vision and adequate image preprocessing, decoding results are enhanced and superior to raw zxing integration, i.e. flutter_zxing.

On Android for privacy-concerned scanning consider barcode_scan2 which wraps zxing java APIs in a seamless way. For non private sensitive use-case prefer mobile_scanner which provides the almighty Google ML Kit barcode.

Features #

  • Computer Vision Detection: YOLO model for accurate barcode localization
  • Image preprocessing and enhancement
  • Multiple Formats: QR codes, Code 128, EAN-13, and more
  • Real-Time Processing: Live camera feed with detection overlay
  • OpenFoodFacts Integration: Automatic product information lookup for demo purposes
  • macOS Compatible: Tested and working on macOS Monterey 12.6.5+

Set-up #

<<<<<<< HEAD

# pubspec.yaml
flutter:
  assets:
    - assets/best.rten  # 11.68 MB - YOLO barcode detection model

Download: best.rten from Hugging Face
License: AGPL-3.0 (Ultralytics)
Attribution Required: See Model License

πŸͺŸ Windows #

# pubspec.yaml
flutter:
  assets:
    - windows/rust_barcode_lib.dll  # 10.87 MB

Add this to your pubspec.yaml: #

  • yolo model is downloaded at class init
  • native libs are handled by the package
  • so just add this package in your yaml and run:

7f10d9d0ce1ee5c4e042201094e415ec7f81009c

flutter pub get

Set-up Macos #

macOS Entitlements

  • Files:
    • your_app/macos/Runner/DebugProfile.entitlements
    • your_app/macos/Runner/Release.entitlements
<key>com.apple.security.device.camera</key>
<true/>

macOS info.plist

<key>NSCameraUsageDescription</key>
<string>This app needs camera access to scan barcodes and QR codes.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs camera access to scan barcodes and QR codes.</string>

Quick Start #

<<<<<<< HEAD

=======

7f10d9d0ce1ee5c4e042201094e415ec7f81009c

import 'package:weebi_barcode_scanner/weebi_barcode_scanner.dart';

// Scan a barcode with one line of code!
var result = await WeebiBarcodeScanner.scan();

if (result.isSuccess) {
  print('Scanned: ${result.code}');
  print('Format: ${result.format}');
} else if (result.isCancelled) {
  print('User cancelled the scan');
} else if (result.hasError) {
  print('Error: ${result.error}');
}

Basic Usage #

import 'package:flutter/material.dart';
import 'package:weebi_barcode_scanner/weebi_barcode_scanner.dart';

class ScannerPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Barcode Scanner')),
      body: BarcodeScannerWidget(
        onBarcodeDetected: (result) {
          print('Scanned: ${result.text}');
          print('Format: ${result.format}');
          
          // Show result dialog
          showDialog(
            context: context,
            builder: (context) => AlertDialog(
              title: Text('Barcode Detected'),
              content: Text('${result.format}: ${result.text}'),
              actions: [
                TextButton(
                  onPressed: () => Navigator.pop(context),
                  child: Text('OK'),
                ),
              ],
            ),
          );
        },
        onError: (error) {
          print('Scanner error: $error');
        },
      ),
    );
  }
}

Point-of-Sale Mode #

BarcodeScannerWidget(
  config: ScannerConfig.pointOfSale(),  // Single scan, haptic feedback
  onBarcodeDetected: (result) {
    // Automatically stops scanning after first detection
    Navigator.pop(context, result);
  },
)

Continuous Scanning Mode #

BarcodeScannerWidget(
  config: ScannerConfig.continuous(),  // Continuous scanning
  onBarcodeDetected: (result) {
    // Keeps scanning for multiple barcodes
    addToCart(result);
  },
)

<<<<<<< HEAD

🎯 Scanner Configurations #

=======

7f10d9d0ce1ee5c4e042201094e415ec7f81009c

Custom Configuration #

ScannerConfig(
  // Detection frequency
  detectionInterval: Duration(milliseconds: 500),
  
  // AI model confidence threshold (0.0-1.0)
  confidenceThreshold: 0.6,
  
  // Image enhancement for damaged barcodes
  enableSuperResolution: true,
  
  // Auto-stop after first detection
  stopAfterFirstScan: true,
  
  // Haptic feedback on detection
  enableHapticFeedback: true,
)

BarcodeResult #

class BarcodeResult {
  final String text;                    // Decoded barcode text
  final String format;                  // Barcode format (QR_CODE, EAN_13, etc.)
  final String? productName;            // Product name (via OpenFoodFacts)
  final String? productBrand;           // Product brand
  final Map<String, dynamic>? location; // Barcode location in image
  final double? confidence;             // Detection confidence (0.0-1.0)
  
  bool get hasProductInfo => productName != null;
  bool get hasLocationInfo => location != null;
}

Debug Information #

BarcodeScannerWidget(
  config: ScannerConfig(
    // Enable detailed logging
    enableDebugMode: true,
  ),
  onError: (error) {
    print('Detailed error: $error');
  },
)

πŸͺ OpenFoodFacts Integration #

Product lookup :

BarcodeScannerWidget(
  onBarcodeDetected: (result) {
    if (result.hasProductInfo) {
      print('Product: ${result.productName}');
      print('Brand: ${result.productBrand}');
      // Additional product data available
    }
  },
)

To enable also price features, add credentials (optional):

# Copy template and add your credentials
cp open_prices_credentials.json.example open_prices_credentials.json
# Edit with your OpenFoodFacts account details

🎨 UI Customization #

Split-Screen Layout #

BarcodeScannerWidget(
  showProductInfo: true,  // Enables split-screen with product details
  onBarcodeDetected: (result) {
    // Product info automatically displayed on right side
  },
)

Custom Overlay #

BarcodeScannerWidget(
  overlayBuilder: (context, detections) {
    return CustomPaint(
      painter: YourCustomOverlayPainter(detections),
    );
  },
)

<<<<<<< HEAD

πŸ”§ Platform Setup #

Self-Contained Design #

  • Embedded AI Model: YOLO detection model included
  • Native Libraries: Rust FFI libraries bundled

=======

7f10d9d0ce1ee5c4e042201094e415ec7f81009c

🚨 Troubleshooting #

Common Issues #

  • Camera not working

    • Ensure camera permissions are granted
    • Check that camera is not in use by another app
    • Restart the app if camera appears frozen
  • Poor detection accuracy

    • Ensure good lighting conditions
    • Try adjusting confidenceThreshold (lower = more sensitive)
    • Enable enableSuperResolution for damaged barcodes
  • Performance issues

    • Increase detectionInterval (less frequent detection)
    • Disable enableSuperResolution if not needed
  • Swift Compilation Error Fix Problem: camera_macos plugin used macOS 14+ APIs that don't exist on macOS Monterey 12.6.5

error: initializer for conditional binding must have Optional type, not 'Bundle'
error: value of type 'AVCaptureConnection' has no member 'isVideoRotationAngleSupported'

Solution: Commented out problematic lines in the cached plugin file File: /Users/mac/.pub-cache/hosted/pub.flutter-io.cn/camera_macos-0.0.9/macos/Classes/CameraMacosPlugin.swift

Lines to comment out:

// Comment out these lines around line 520-530:
//                                #if compiler(<5.8.1)
//                                    if #available(macOS 14.0, *), connection.isVideoRotationAngleSupported(self.orientation){
//                                        connection.videoRotationAngle = self.orientation
//                                    }
//                                #endif

πŸ“ License #

MIT License - see LICENSE file for details. Free for enterprise and commercial use-case

Bundled Components #

This package includes several bundled components to provide a seamless integration experience:

1. Weebi YOLO Barcode Detection Model (best.rten)

2. Weebi Rust Barcode Library (e.g. rust_barcode_lib.dll)

  • File: windows/rust_barcode_lib.dll
  • Size: ~2.1MB
  • Purpose: High-performance barcode processing and rxing integration

3. Dart FFI Bindings

  • Files: lib/dart_barcode/
  • Purpose: Flutter FFI integration with the Rust library

When using this package:

  1. Include weebi attribution in your app credits
  2. Respect AGPL-3.0 for the YOLO model

Support && custom use-case #

0
likes
110
points
19
downloads

Publisher

verified publisherweebi.com

Weekly Downloads

Self-contained barcode scanner with real-time detection overlay. Features embedded YOLO detection, cross-platform support (Windows/macOS), point-of-sale optimizations, and OpenFoodFacts integration. No manual setup required.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

camera, camera_macos, camera_windows, ffi, flutter, image, path, path_provider, weebi_openfoodfacts_service

More

Packages that depend on weebi_barcode_scanner

Packages that implement weebi_barcode_scanner