FrenkyDema / qrcode_barcode_scanner

Listen barcode input from keyboard device interface
https://pub.dev/packages/qrcode_barcode_scanner
MIT License
6 stars 2 forks source link
android dart flutter flutter-plugin qrcode-reader

QRCode & Barcode Scanner

pub package Build Status License

Overview

The QRCode & Barcode Scanner plugin is designed to manage QR and Barcode scanning from external devices, offering a streamlined API for integration in Android applications.

Important: This package currently supports Android only.

Features

Installation

Add the following dependency in your pubspec.yaml file:

flutter pub add qrcode_barcode_scanner

Usage Example

Here is a simple example of how to use the QrcodeBarcodeScanner:

import 'package:qrcode_barcode_scanner/qrcode_barcode_scanner.dart';

class MyScannerApp extends StatefulWidget {
  @override
  _MyScannerAppState createState() => _MyScannerAppState();
}

class _MyScannerAppState extends State<MyScannerApp> {
  String? _scanValue;

  @override
  void initState() {
    super.initState();
    QrcodeBarcodeScanner(
      onScannedCallback: (String value) {
        setState(() {
          _scanValue = value;
        });
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("QR & Barcode Scanner")),
      body: Center(
        child: Text(_scanValue ?? "Waiting for scan..."),
      ),
    );
  }
}

API Documentation

Class: QrcodeBarcodeScanner

The QrcodeBarcodeScanner class is the core component of this plugin. It allows you to configure and manage barcode and QR code scanning events.

Constructor:

QrcodeBarcodeScanner({
  required ScannedCallback onScannedCallback,
});

Properties:

Tested Devices

This plugin has been tested with the following devices:

Additional Resources

For more detailed documentation and advanced use cases, check out the Wiki.

Changelog

Check out the Changelog for details on recent updates.

Contributing

Want to contribute? Check out the Contribution Guide to get started!

License

This project is licensed under the MIT License. See the LICENSE file for details.