qrcode_barcode_scanner 3.0.0 copy "qrcode_barcode_scanner: ^3.0.0" to clipboard
qrcode_barcode_scanner: ^3.0.0 copied to clipboard

Plugins to manage the reading of QR code or barcode from an external device as a keyboard.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String? _scanValue;

  void setScannedValue(String value) {
    debugPrint("$value ${value.length}");
    setState(() {
      _scanValue = value;
    });
  }

  @override
  void initState() {
    super.initState();
    QrcodeBarcodeScanner(
      onScannedCallback: (String value) {
        // debugPrint("Scan value vase64: '${utf8.decode(base64.decode(value))}'");
        setScannedValue(value);
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: [
            Expanded(
              child: Center(
                child: Text(
                  _scanValue ?? 'none',
                  style: const TextStyle(fontSize: 30),
                ),
              ),
            ),
            ElevatedButton(
              onPressed: () {
                setState(() {
                  _scanValue = null;
                });
              },
              child: const Text("Clear scanned"),
            )
          ],
        ),
      ),
    );
  }
}
7
likes
0
points
176
downloads

Publisher

verified publisherfrancescodema.dev

Weekly Downloads

Plugins to manage the reading of QR code or barcode from an external device as a keyboard.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on qrcode_barcode_scanner