Search packages, repositories and app categories

Package detailsv3.0.0

camcode

A camera barcode scanner for Flutter Web using your favorite Javascript library

30-day downloads
92
Likes
45
Pub points
60

Install package

flutter pub add camcode

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Camcode is a Flutter Web package that enables barcode and QR code scanning by leveraging a popular JavaScript library through platform channels. Designed specifically for web environments, it integrates seamlessly with Flutter applications to provide real-time scanning capabilities using the device's camera. The package abstracts the complexity of browser camera access and JavaScript interoperability, offering a simple API for developers to implement scanning features without deep knowledge of web-specific implementation details. It’s ideal for web apps requiring quick, reliable barcode or QR code reading.

Use cases

  • Web-based inventory management
  • Online ticket scanning
  • Digital document verification
  • Mobile web checkout systems
  • Quick product information lookup

Key features

  • Uses native JavaScript barcode libraries
  • Real-time scanning on Flutter Web
  • Simple integration via pub add
  • Cross-browser compatibility
  • Lightweight and fast

Suitable for

  • Flutter Web developers
  • Web apps needing barcode scanning
  • Projects with QR code input requirements
  • Developers avoiding complex JS interop
  • Prototyping rapid scanning features

Considerations

  • Only works on Flutter Web
  • Requires browser camera permissions
  • Depends on external JavaScript library
  • Limited to supported barcode types
  • No support for mobile platforms

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

camcode

A camera barcode scan library for Flutter Web

Web build status

Getting Started

Add a javascript file for barcode scan

function detectBarcode(dataUrl, callback) {

    // call here your favorite javascript barcode scan library
    // input must be an image dataUrl
    // output must be a single String

    // don't forget to trigger the call back in order to get the result
    callback(barcode);
}

Import javascript files into your index.html

<script src="LINK_TO_MY_AWESOME_JAVASCRIPT_BARCODE_SCAN_LIB"></script>
<script src="js/barcode.js"></script> // the javascript file with the detectBarcode function

Use it

import 'package:camcode/cam_code_scanner.dart';

showDialog(
    context: context,
    builder: (context) => CamCodeScanner(
    width: MediaQuery.of(context).size.width,
    height: MediaQuery.of(context).size.height,
    refreshDelayMillis: 200,
    onBarcodeResult: (barcode) {
        // do whatever you want
    },
    minimalResultCount: 2,
    ),
);

More options

Manually release resources

Sometimes, depending on your camcode usage, you may need to release resources manually.

1- To do so, create first a controller for the scanner

// Create a controller to send instructions to scanner
  final CamCodeScannerController _controller = CamCodeScannerController();

2- Then, add it to the CamCodeScanner

CamCodeScanner(
    width: ...,
    height: ...,
    refreshDelayMillis: ...,
    onBarcodeResult: (barcode) {
        ...
    },
    controller: _controller,
),

3- And finally, just call releaseResources() method when required

ElevatedButton(
    onPressed: () {
        _controller.releaseResources();
    },
    child: Text('Release resources'),
),

Calling this method will close the camera and stop the scanner process

Categories

Dependencies

Dependency list 1 items

  • js^0.6.2

Source repository

Projects using this package

No data available yet.