qr_hid_reader 0.0.1 copy "qr_hid_reader: ^0.0.1" to clipboard
qr_hid_reader: ^0.0.1 copied to clipboard

Implementation of the QR scanner listener that handles output as keyboard events.

example/lib/main.dart

import 'dart:io';

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

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const KeyboardPage(),
    );
  }
}

class KeyboardPage extends StatefulWidget {
  const KeyboardPage({Key? key}) : super(key: key);

  @override
  State<KeyboardPage> createState() => _KeyboardPageState();
}

class _KeyboardPageState extends State<KeyboardPage> {
  late final ScannerManager _detector;

  @override
  void initState() {
    super.initState();

    _detector = Platform.isAndroid
        ? AndroidScannerManager(
            targetSources: [257, 769],
          )
        : CommonScannerManager();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          StreamBuilder<String>(
            stream: _detector.scanned,
            builder: (_, value) {
              return Text('Raw data: ${value.data}');
            },
          ),
          const TextField(),
        ],
      ),
    );
  }
}
4
likes
150
points
47
downloads

Publisher

verified publisherbakersoft.de

Weekly Downloads

Implementation of the QR scanner listener that handles output as keyboard events.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on qr_hid_reader